LONDON - Coffee Shop Opportunity

A description of the problem and a discussion of the background.

A client with considerable ties to the African coffee market has asked us to do an analysis for him of the coffee shop opportunity in the UK and more specifically in London.

He believes his competitive advantage lies with the product that he plans to deliver .....

At every interval between commodity traded coffee and the absolute quality frontier of the industry, a difference exists in the level of culinary appreciation for the beverage resulting from the impact of varietal, provenance, processing and preparation.

Each progressing level corresponds to a higher level of appreciation and increases the quality of the product. Coffee which is sourced and prepared to the highest standards, results in a product of superior quality and therefore, inherent value.

A specific focus on social responsibility sourcing remains a key factor.

Emerging social pressure dating back as far as the late 1960s has spawned the emergence of higher levels of accountability on the behalf of businesses – known as Corporate Social Responsibility (CSR). Traditionally the responsibility of a business was solely to financial stakeholders. CSR is the movement towards accountability and having a positive impact on any stakeholders in a business’ environment.

This includes, consideration for communities, the environment, consumers and all members of the public sphere. Increasing adeptness, by the media and regulatory bodies, has been successful in holding businesses accountable for their activities. This has been mirrored by the increasing awareness of consumers, who now favour and see value in purchases which have a broader, positive, social impact.

This means there is now potential to create value for consumers and subsequently gain competitive advantage for business which commit to more accountable business practices.

Needs to identify the best location for his coffee shop

To be successful, he needs the right location for his coffee shop. He wants something that fits the following criteria:

1) Centrally located and easy to access
2) Highly visible and experiences consistent foot traffic
3) High population density area
4) A space that fits his vision

Keep in mind that effective restaurant spaces are highly sought after and difficult to find. It therefore might take a while to find just the right spot, but for a business type that benefits from ease of access and casual traffic, it’s worth taking your time to find the right spot.

Our initial work would atleast narrow down the possible areas to focus on.

Summary

Coffee shops, cafés and carts which operate within the independent industry mostly fall within the definition of differentiation strategists. This is characterised by a business model which seeks to create value based on increasing benefits for all consumers in the market for coffee.

In comparison to franchise alternatives, there are three unique and valuable attributes which exist throughout the industry. These are a higher quality product, a greater commitment to social responsibility and a great location. Higher levels of each correlate ultimately to greater competitive advantage.

Specifically he would like a better understanding of:
1) Overall UK coffee market opportunity,
2) Where is the opportunity (franchised, branded, non-speciality, etc.) within UK coffee shops,
3) what is the population density for different boroughs' in London,
4) On which areas within London are the major coffee shops focused,
5) Where (borough) should he settle his young family, whom are used to the great outdoors and lots of space.

A description of the data and how it will be used to solve the problem.

Data needed to give a better understanding of the UK / London coffee market.

1) Current UK coffee consumption relative to the world
Global Coffee consumption (IMF / Wikipedia) = 'Coursera_Capstone./Consumption.xls'

2) Detailed breakdown of the UK coffee shops market
    - UK Coffee Shops (Statista) = 'Coursera_Capstone./UK Coffee Shops.xls'
    - UK Costa Coffee Shops (Costa) = 'https://www.costa.co.uk/locations/store-locator'
    - UK Starbucks Shops (Starbuks) = 'Coursera_Capstone./London directory.csv'
    - UK Coffee Shops = Foursquare data scrapping

3) Population density per London borough
    - LDN Borough (Wikipedia) = 'https://en.wikipedia.org/wiki/List_of_London_boroughs#List_of_boroughs_and_local_authorities'
    - LDN Borough json (London Gov) = 'Coursera_Capstone./london_boroughs.json'

4) Analysis of the London coffee shop market in relation to population density
   - Data Analysis

5) Breakdown of the London borough by various settling criteria; crime, green space, house prices, etc.
    - Data London Gov = 'Coursera_Capstone./london-borough-profiles-2016 Data set.csv'

Solving the problem

With the data to be collected we should be able to:

1) define the potential coffee consumption opportunity within the UK
2) define the growth opportunity within coffee shops in the UK
3) Identify through the use of population density analysis where the best coffee shop opportunities lie
4) Identify a couple of Borough which should be a focus area for future house hunting.

Project Conclusion

1) Overall UK coffee market opportunity

The UK coffee consumption market (@ 1.7Kg/capita) is under indexed relative to the rest of the world
In [85]:
# In this table we illustrate the UK coffee consumption per capita versus the main coffee/capita consumer markets 
# Clearly the UK is under indexed when it comes to consumption/capita
df_coffee
Out[85]:
Country Coffee GDP/cap
0 Luxembourg 6.50 107641
1 Switzerland 7.90 66307
2 Norway 9.90 62183
3 United States 4.20 59928
4 Iceland 9.00 55322
5 Netherlands 8.40 54422
6 Austria 6.10 53879
7 Germany 5.50 52556
8 Sweden 8.20 51405
9 Belgium 6.80 49367
10 Canada 6.50 46510
11 Finland 12.00 46344
12 United Kingdom 1.70 44920
13 France 5.40 44033
14 Italy 5.90 40924
15 Spain 4.50 39037
16 Slovenia 5.80 36387
17 Cyprus 4.90 36012
18 Estonia 4.50 33448
19 Portugal 4.30 32554
20 Greece 5.40 28583
21 Croatia 5.10 26296
22 Brazil 5.80 15553
23 Lebanon 4.80 14513
24 Bosnia and Herzegovina 6.20 13100
We tried to quantify the potential upside consumption through the use of regression analysis versus income / capita
In [86]:
# GDP/Capita as potential predictor variable of coffee consumption
sns.regplot(x="GDP/cap", y="Coffee", data=df_coffee)
plt.ylim(0,)
Out[86]:
(0, 13.133247374920485)
In [87]:
# From the above chart its clear that the UK is clearly an underperformer when it comes to coffee consumption / capita
# Let's calculate the Pearson Correlation Coefficient and P-value of 'GDP/capita' and 'Coffee' consumption.
pearson_coef, p_value = stats.pearsonr(df_coffee['GDP/cap'], df_coffee['Coffee'])
print("The Pearson Correlation Coefficient is", pearson_coef, " with a P-value of P =", p_value)
The Pearson Correlation Coefficient is 0.3157010441042881  with a P-value of P = 0.1242165217944004
Unfortunately there is very little statistical significance that we can rely on.

Accordingly we could not statistically predict how much upside coffee consumption there is in the UK.

2) Where is the opportunity (franchised, branded, non-speciality, etc.) within UK coffee shops

In [88]:
# Let's take a closer look at the UK coffee shop market over the last couple of years as well as future expectations
dfcof
Out[88]:
Year Costa Starbucks Nero Other Branded Indi Non Speciality Total
0 2013 1578 764 519 2241 5102 5830 6367 17299
1 2014 1755 791 550 2408 5504 6034 7654 19192
2 2015 1931 842 582 2634 5989 6257 8873 21119
3 2016 2034 898 613 3039 6584 6501 9405 22490
4 2017 2218 951 637 3694 7500 6755 9830 24085
5 2018 2422 988 666 4073 8149 7022 10312 25483
6 2019 2713 995 706 4239 8653 7306 10848 26807
7 2020e 0 0 0 0 9118 7605 11412 28135
8 2021e 0 0 0 0 9561 7919 11994 29474
9 2022e 0 0 0 0 9986 8247 12606 30839
10 2023e 0 0 0 0 10402 8592 13236 32230
In [89]:
# plot the coffee shop growth since 2013
dfcofh.plot('Year',['Other', 'Costa', 'Starbucks', 'Nero'], kind = 'bar', figsize=(15, 8) )

plt.xlabel('Year') # add to x-label to the plot
plt.ylabel('Number of shops') # add y-label to the plot
plt.title('UK branded coffee shops from 2013 to 2019') # add title to the plot
plt.show()
In [90]:
# Let's calculate the compounded growth within the various coffee shop opportunities
dfcagr
Out[90]:
Year Costa Starbucks Nero Other Branded Indi Non Speciality Total
0 nan 0.09 0.05 0.05 0.11 0.09 0.04 0.09 0.08
1 nan nan nan nan nan 0.05 0.04 0.05 0.05
Historical coffee shop growth has been strong at a 6y CAGR of 8%
* Non-franchised coffee shops grew the strongest within branded coffee shops at 11%
* Costa grew the strongest within the big brand coffee shops at 9%
Future coffee shop growth remains strong @ 5%

Within branded coffee shops we believe the opportunity remains with non-franchised shops, who are able to deliver a differentiated strategy focused on;

* Quality products
* Socially responsible sourcing
* best locations

3) what is the population density for different boroughs' in London

Clearly an investor wants to focus his investments on areas where the population density is the highest
In [101]:
# In this table we calculated the London boroughs with the highest population density per acre
dfld
Out[101]:
Borough Population Area Population / Area
17 Islington 215667 6 37,573
28 Tower Hamlets 272890 8 35,765
10 Hackney 257379 7 34,970
18 Kensington and Chelsea 155594 5 33,247
20 Lambeth 314242 10 30,332
11 Hammersmith and Fulham 178685 6 28,228
31 Westminster 226841 8 27,363
5 Camden 229719 8 27,348
26 Southwark 298464 11 26,792
30 Wandsworth 310516 13 23,471
12 Haringey 263386 11 23,064
23 Newham 318227 14 22,763
21 Lewisham 286180 14 21,089
3 Brent 317264 17 18,998
29 Waltham Forest 265797 15 17,732
7 Ealing 342494 21 15,975
9 Greenwich 264008 18 14,442
22 Merton 203223 15 13,996
0 Barking and Dagenham 194352 14 13,952
24 Redbridge 288272 22 13,236
13 Harrow 243372 19 12,487
16 Hounslow 262407 22 12,143
19 Kingston upon Thames 166793 14 11,599
27 Sutton 195914 17 11,572
6 Croydon 372752 33 11,157
1 Barnet 369088 33 11,021
2 Bexley 236687 23 10,123
8 Enfield 320524 32 10,098
25 Richmond upon Thames 191365 22 8,632
15 Hillingdon 286806 45 6,421
32 City of London 7000 1 6,250
14 Havering 242080 43 5,584
4 Bromley 317899 58 5,484
In [102]:
# In this London chloropeth map we have mapped the London boroughs based on their population desity
ldnc_map
Out[102]:
Based on our population density analysis, we believe the best boroughs to focus on include;
* Islington
* Tower Hamlets
* Hackney
* Kensington and Chelsea
* Lambeth

4) On which areas within London are the major coffee shops focused

We used Foursquare data to extract all the appropriate coffee shops in the main areas of interest
In [103]:
# In this map we plotted the London coffee shop locations over the popuilation density map 
# Green markers represents Starbucks shops
# Orange markers represent Costa coffee shops and other non-franchised coffee shops
ldn_map
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-103-d319c8ccddfc> in <module>
      2 # Green markers represents Starbucks shops
      3 # Orange markers represent Costa coffee shops and other non-franchised coffee shops
----> 4 ldn_map

NameError: name 'ldn_map' is not defined
From this map it's clear that the major focus for London based coffee shops are within the inner London circle

5) Where (borough) should he settle his young family, whom are used to the great outdoors and lots of space

Boroughs to focus on would be where;
* Crime is low
* Greenspace is high
* Population density is low
In [192]:
# Borough data from London Data Gov was extracted and presented below
# Establish the best place to live in London by specific column heading
column_heading = '%Greenspace'
dfldn_merged.sort_values(by=column_heading, inplace=True, ascending=False)
dfldn_merged
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  after removing the cwd from sys.path.
Out[192]:
Borough Population Area Population / Area Average Age Annual Pay Crime/1000 House Price %Greenspace
31 Havering 242080 43 5,584 40 32274 629 250000 59.3
32 Bromley 317899 58 5,484 40 36498 641 335000 57.8
28 Richmond upon Thames 191365 22 8,632 39 39563 563 535000 50.8
29 Hillingdon 286806 45 6,421 36 32989 766 307000 49.2
27 Enfield 320524 32 10,098 36 31094 694 285000 45.6
25 Barnet 369088 33 11,021 37 33084 627 400000 41.3
19 Redbridge 288272 22 13,236 36 35665 697 301500 40.6
30 City of London 7000 1 6,250 43 765000 4.8
21 Hounslow 262407 22 12,143 36 792 319950 39.6
6 Westminster 226841 8 27,363 38 42798 2124 875000 38.2
24 Croydon 372752 33 11,157 37 32887 770 265000 37.1
22 Kingston upon Thames 166793 14 11,599 37 36767 585 385000 36.4
20 Harrow 243372 19 12,487 38 32529 504 370000 34.6
17 Merton 203223 15 13,996 37 33122 597 385000 34.6
16 Greenwich 264008 18 14,442 35 31757 794 317000 34.4
18 Barking and Dagenham 194352 14 13,952 33 28428 834 215000 33.6
23 Sutton 195914 17 11,572 39 31387 559 285000 32.0
26 Bexley 236687 23 10,123 39 32040 518 250000 31.7
14 Waltham Forest 265797 15 17,732 35 29532 780 320000 31.4
15 Ealing 342494 21 15,975 36 28978 755 388000 30.9
9 Wandsworth 310516 13 23,471 35 39562 726 532500 26.9
10 Haringey 263386 11 23,064 35 30931 902 405000 25.5
8 Southwark 298464 11 26,792 34 34537 1006 420000 24.9
7 Camden 229719 8 27,348 36 39610 1235 675000 24.8
11 Newham 318227 14 22,763 32 27174 908 250000 23.9
2 Hackney 257379 7 34,970 33 32199 996 433000 23.2
12 Lewisham 286180 14 21,089 35 31783 770 315000 22.5
13 Brent 317264 17 18,998 36 29777 788 385000 21.9
5 Hammersmith and Fulham 178685 6 28,228 36 38029 1132 661000 19.1
4 Lambeth 314242 10 30,332 34 33341 1046 420000 17.3
1 Tower Hamlets 272890 8 35,765 31 34849 999 383000 15.2
3 Kensington and Chelsea 155594 5 33,247 39 1209 1195000 15.1
0 Islington 215667 6 37,573 35 35476 1212 530000 12.4
Of the top 5 boroughs based on;
* Greenspace available, 
* the lowest crime rates 
* highest living standards   
Richmond upon Thames

Is potentially one of the best London Boroughs to settle a family

In [193]:
# When analysing the different LDN Borough clusters ...
map_clusters
Out[193]:
In [194]:
# It's evident that Richmond upon Thames fall within cluster 5 (green) - which is the social cluster
london_merged.loc[london_merged['Cluster Labels'] == 5, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[194]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
7 Croydon Croydon Pub Coffee Shop Portuguese Restaurant Burrito Place Supermarket Bookstore Gaming Cafe Breakfast Spot Brewery Spanish Restaurant 51 -0
26 Richmond upon Thames Richmond upon Thames Pub Coffee Shop Italian Restaurant Pharmacy Grocery Store Indian Restaurant Garden Bookstore Discount Store Steakhouse 51 -0
30 Waltham Forest Waltham Forest Pub Coffee Shop Gym / Fitness Center Pizza Place Concert Hall Field Beer Store Tea Room Grocery Store Pool 52 -0
31 Wandsworth Wandsworth Pub Coffee Shop Clothing Store Pizza Place Breakfast Spot Supermarket Asian Restaurant Sandwich Place Indian Restaurant Restaurant 51 -0

Summary

1) There remains a major opportunity for coffee shops in London based on;
    * Coffee consumption in the UK remains low compared to the rest of the world
    * Coffee shop growth in the UK is expected to remain growing at a strong rate in the future
    * Analysing current coffee shop locations versus population density suggest opportunities remain.
2) The open African lifestyle is potentially still available to families within certain London boroughs     

Thank you

Import all applicable libraries

In [7]:
# Install all new software needed
#!conda install -c conda-forge selenium --yes
#!conda install -c conda-forge geocoder --yes
#!conda install -c conda-forge geopandas --yes # import geopandas for mapping with pandas
#!conda install -c anaconda zipfile36 --yes
#!conda install -c anaconda urllib3 --yes
#!conda install -c conda-forge folium=0.5.0 --yes # uncomment this line if you haven't completed the Foursquare API lab
#!conda install -c conda-forge geopy --yes # uncomment this line if you haven't completed the Foursquare API lab
#!conda install nb_conda --yes # install presentation software
#!conda install -c conda-forge jupyter_contrib_nbextensions --yes
#!conda install -c conda-forge jupyter_nbextensions_configurator --yes
#!conda install nbbrowserpdf --yes
print('Software updated')
Software updated
In [8]:
# Import all libraries
import numpy as np # library to handle data in a vectorized manner
from scipy import stats

import pandas as pd # library for data analsysis
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)

import json # library to handle JSON files

from geopy.geocoders import Nominatim # convert an address into latitude and longitude values

import requests # library to handle requests
from pandas.io.json import json_normalize # tranform JSON file into a pandas dataframe

import folium # map rendering library

#import geopandas as gpd
#from geopy.geocoders import Nominatim

import random # library for random number generation

import matplotlib.pyplot as plt # plotting library
#%matplotlib inline # backend for rendering plots within the browser
import matplotlib.cm as cm
import matplotlib.colors as colors

# from zipfile import ZipFile
##from shapely.geometry import shape  
# from io import StringIO
# import urllib3
##from StringIO import StringIO
##import shapefile
##from shapely.geometry import shape  
##import osr
# import io ## Python imports

from sklearn.cluster import KMeans # Import ML KMeans function
from sklearn.datasets.samples_generator import make_blobs

# We need selenium to drive dynamic buttons within dynamic websites
from selenium import webdriver  # For selenium - setup chrome as our webdriver
import time

from bs4 import BeautifulSoup # Import beautifulSoup to scrap web pages
import requests
import os
import folium 
import lxml.html as lh

import seaborn as sns

print('Libraries imported.')
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/sklearn/utils/deprecation.py:144: FutureWarning: The sklearn.datasets.samples_generator module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.datasets. Anything that cannot be imported from sklearn.datasets is now part of the private API.
  warnings.warn(message, FutureWarning)
Libraries imported.
In [9]:
print('Hello Capstone Project Course')
Hello Capstone Project Course

1) Establish the growth opportunities within UK coffee shops

UK Coffee consumption

In [10]:
# Import top 25 coffee consumption data from excel
data_coffee = pd.read_excel (r'/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./Consumption.xls')
df_coffee = pd.DataFrame(data_coffee, columns= ['Country', 'Coffee', 'GDP/cap'])
df_coffee
Out[10]:
Country Coffee GDP/cap
0 Luxembourg 6.5 107641
1 Switzerland 7.9 66307
2 Norway 9.9 62183
3 United States 4.2 59928
4 Iceland 9.0 55322
5 Netherlands 8.4 54422
6 Austria 6.1 53879
7 Germany 5.5 52556
8 Sweden 8.2 51405
9 Belgium 6.8 49367
10 Canada 6.5 46510
11 Finland 12.0 46344
12 United Kingdom 1.7 44920
13 France 5.4 44033
14 Italy 5.9 40924
15 Spain 4.5 39037
16 Slovenia 5.8 36387
17 Cyprus 4.9 36012
18 Estonia 4.5 33448
19 Portugal 4.3 32554
20 Greece 5.4 28583
21 Croatia 5.1 26296
22 Brazil 5.8 15553
23 Lebanon 4.8 14513
24 Bosnia and Herzegovina 6.2 13100
From the above information it's clear that the UK consumes much less coffee than the rest of the global markets.

At 1.7kg we should establish what is the potential upside coffee consumption for the UK.

In [11]:
# GDP/Capita as potential predictor variable of coffee consumption
sns.regplot(x="GDP/cap", y="Coffee", data=df_coffee)
plt.ylim(0,)
Out[11]:
(0, 13.318383665345447)
In [12]:
# Let's examine the correlation
df_coffee[["GDP/cap", "Coffee"]].corr()
Out[12]:
GDP/cap Coffee
GDP/cap 1.000000 0.315701
Coffee 0.315701 1.000000
In [13]:
# Let's calculate the Pearson Correlation Coefficient and P-value of 'GDP/capita' and 'Coffee' consumption.
pearson_coef, p_value = stats.pearsonr(df_coffee['GDP/cap'], df_coffee['Coffee'])
print("The Pearson Correlation Coefficient is", pearson_coef, " with a P-value of P =", p_value)
The Pearson Correlation Coefficient is 0.3157010441042881  with a P-value of P = 0.1242165217944004
Clearly there is no significant correlation between GDP/Capita and coffee consumption. However, overall UK coffee consumption remains extremely low implying upside potential.

UK Tea Consumption

Lets do the same calculations for the UK tea market to see if we can find any correlations

In [14]:
# Import top 25 Tea consumption data from excel
data_tea = pd.read_excel(r'/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./Consumption_tea.xlsx')
df_tea = pd.DataFrame(data_tea, columns= ['Country', 'Tea', 'GDP/cap'])
df_tea
Out[14]:
Country Tea GDP/cap
0 Saudi Arabia 0.901364 83893
1 Ireland 2.191327 76745
2 United Arab Emirates 0.722273 74035
3 Hong Kong 0.649091 61671
4 Netherlands 0.779091 54422
5 Germany 0.692727 52556
6 Australia 0.749545 49378
7 Canada 0.509545 46510
8 United Kingdom 1.945909 44920
9 Japan 0.969545 42067
10 New Zealand 1.195000 40748
11 Poland 1.001818 29924
12 Turkey 3.157489 28002
13 Russia 1.386818 25763
14 Chile 0.733182 24747
15 China 0.567273 16842
16 South Africa 0.813182 13526
17 Egypt 1.014091 11608
18 Ukraine 0.583636 8699
19 Morocco 1.219091 8225
In [15]:
# GDP/Capita as potential predictor variable of tea consumption
sns.regplot(x="GDP/cap", y="Tea", data=df_tea)
plt.ylim(0,)
Out[15]:
(0, 3.3065803189749254)
In [16]:
# Let's calculate the Pearson Correlation Coefficient and P-value of 'GDP/capita' and 'Tea' consumption.
pearson_coef, p_value = stats.pearsonr(df_tea['GDP/cap'], df_tea['Tea'])
print("The Pearson Correlation Coefficient is", pearson_coef, " with a P-value of P =", p_value)
The Pearson Correlation Coefficient is 0.028994850680487343  with a P-value of P = 0.9034181744523213
Again we can clearly see that there is no correlation and/or statistical relevance between GDP/capita and tea consumption. However, tea is a major consumed hot beverage in the UK compared to the rest of the world.

2) Detailed breakdown of the UK coffee shop market

In [17]:
# Import UK coffee shop data from excel
data = pd.read_excel (r'/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./UK Coffee Shops.xls')
dfcof = pd.DataFrame(data, columns= ['Year','Costa', 'Starbucks', 'Nero', 'Other', 'Branded', 'Indi', 'Non Speciality', 'Total'])
dfcof
Out[17]:
Year Costa Starbucks Nero Other Branded Indi Non Speciality Total
0 2013 1578 764 519 2241 5102 5830 6367 17299
1 2014 1755 791 550 2408 5504 6034 7654 19192
2 2015 1931 842 582 2634 5989 6257 8873 21119
3 2016 2034 898 613 3039 6584 6501 9405 22490
4 2017 2218 951 637 3694 7500 6755 9830 24085
5 2018 2422 988 666 4073 8149 7022 10312 25483
6 2019 2713 995 706 4239 8653 7306 10848 26807
7 2020e 0 0 0 0 9118 7605 11412 28135
8 2021e 0 0 0 0 9561 7919 11994 29474
9 2022e 0 0 0 0 9986 8247 12606 30839
10 2023e 0 0 0 0 10402 8592 13236 32230
In [18]:
# Calculate the compounded growth over the last 6 years for all the shop types and the future 4 years growth expectations 
cagr = pd.read_excel('/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./Shops cagr.xlsx')
dfcagr = pd.DataFrame(cagr, columns= ['Year','Costa', 'Starbucks', 'Nero', 'Other', 'Branded', 'Indi', 'Non Speciality', 'Total'])
pd.options.display.float_format = "{:,.2f}".format
dfcagr["Year"] = dfcagr["Year"].astype('str')
dfcagr
Out[18]:
Year Costa Starbucks Nero Other Branded Indi Non Speciality Total
0 nan 0.09 0.05 0.05 0.11 0.09 0.04 0.09 0.08
1 nan nan nan nan nan 0.05 0.04 0.05 0.05
UK Coffee shop growth has been / and is expected to remain above country growth
  • Historically - overall UK coffee shops grew by a compound of 8% over the last 6 years
  • Future - UK coffee shops are expected to grow by 5% over the next 4 years
In [19]:
dfcof.dtypes
Out[19]:
Year              object
Costa              int64
Starbucks          int64
Nero               int64
Other              int64
Branded            int64
Indi               int64
Non Speciality     int64
Total              int64
dtype: object
In [20]:
# Delete row with label 7, 8, 9, 10 
dfcofh = dfcof.drop([7, 8, 9, 10], axis=0)
dfcofhis = dfcofh.reset_index(drop = True)
dfcofh
Out[20]:
Year Costa Starbucks Nero Other Branded Indi Non Speciality Total
0 2013 1578 764 519 2241 5102 5830 6367 17299
1 2014 1755 791 550 2408 5504 6034 7654 19192
2 2015 1931 842 582 2634 5989 6257 8873 21119
3 2016 2034 898 613 3039 6584 6501 9405 22490
4 2017 2218 951 637 3694 7500 6755 9830 24085
5 2018 2422 988 666 4073 8149 7022 10312 25483
6 2019 2713 995 706 4239 8653 7306 10848 26807
In [21]:
# plot the coffee shop growth since 2013
dfcofh.plot('Year',['Other', 'Costa', 'Starbucks', 'Nero'], kind = 'bar', figsize=(15, 8) )

plt.xlabel('Year') # add to x-label to the plot
plt.ylabel('Number of shops') # add y-label to the plot
plt.title('UK branded coffee shops from 2013 to 2019') # add title to the plot
plt.show()
What is clear from this analysis is that coffee shops are expected to grow strongly over the next 4 years

3) Establish and illustrate the London borough population dencities

In [93]:
# London borough data frame
dfl_input = dfl
dfl_input
Out[93]:
Borough Inner Status Local authority Political control Headquarters Area (sq mi) Population (2013 est)[1] Co-ordinates Nr. in map
0 Barking and Dagenham [note 1] Barking and Dagenham London Borough Council Labour Town Hall, 1 Town Square 13.93 194,352 51°33′39″N 0°09′21″E / 51.5607°N 0.1557°E /... 25
1 Barnet Barnet London Borough Council Conservative Barnet House, 2 Bristol Avenue, Colindale 33.49 369,088 51°37′31″N 0°09′06″W / 51.6252°N 0.1517°W /... 31
2 Bexley Bexley London Borough Council Conservative Civic Offices, 2 Watling Street 23.38 236,687 51°27′18″N 0°09′02″E / 51.4549°N 0.1505°E /... 23
3 Brent Brent London Borough Council Labour Brent Civic Centre, Engineers Way 16.70 317,264 51°33′32″N 0°16′54″W / 51.5588°N 0.2817°W /... 12
4 Bromley Bromley London Borough Council Conservative Civic Centre, Stockwell Close 57.97 317,899 51°24′14″N 0°01′11″E / 51.4039°N 0.0198°E /... 20
5 Camden Y Camden London Borough Council Labour Camden Town Hall, Judd Street 8.40 229,719 51°31′44″N 0°07′32″W / 51.5290°N 0.1255°W /... 11
6 Croydon Croydon London Borough Council Labour Bernard Weatherill House, Mint Walk 33.41 372,752 51°22′17″N 0°05′52″W / 51.3714°N 0.0977°W /... 19
7 Ealing Ealing London Borough Council Labour Perceval House, 14-16 Uxbridge Road 21.44 342,494 51°30′47″N 0°18′32″W / 51.5130°N 0.3089°W /... 13
8 Enfield Enfield London Borough Council Labour Civic Centre, Silver Street 31.74 320,524 51°39′14″N 0°04′48″W / 51.6538°N 0.0799°W /... 30
9 Greenwich [note 2] Y [note 3] Royal Greenwich London Borough Council Labour Woolwich Town Hall, Wellington Street 18.28 264,008 51°29′21″N 0°03′53″E / 51.4892°N 0.0648°E /... 22
10 Hackney Y Hackney London Borough Council Labour Hackney Town Hall, Mare Street 7.36 257,379 51°32′42″N 0°03′19″W / 51.5450°N 0.0553°W /... 9
11 Hammersmith and Fulham [note 4] Y Hammersmith and Fulham London Borough Council Labour Town Hall, King Street 6.33 178,685 51°29′34″N 0°14′02″W / 51.4927°N 0.2339°W /... 4
12 Haringey [note 3] Haringey London Borough Council Labour Civic Centre, High Road 11.42 263,386 51°36′00″N 0°06′43″W / 51.6000°N 0.1119°W /... 29
13 Harrow Harrow London Borough Council Labour Civic Centre, Station Road 19.49 243,372 51°35′23″N 0°20′05″W / 51.5898°N 0.3346°W /... 32
14 Havering Havering London Borough Council Conservative (council NOC) Town Hall, Main Road 43.35 242,080 51°34′52″N 0°11′01″E / 51.5812°N 0.1837°E /... 24
15 Hillingdon Hillingdon London Borough Council Conservative Civic Centre, High Street 44.67 286,806 51°32′39″N 0°28′34″W / 51.5441°N 0.4760°W /... 33
16 Hounslow Hounslow London Borough Council Labour Hounslow House, 7 Bath Road 21.61 262,407 51°28′29″N 0°22′05″W / 51.4746°N 0.3680°W /... 14
17 Islington Y Islington London Borough Council Labour Customer Centre, 222 Upper Street 5.74 215,667 51°32′30″N 0°06′08″W / 51.5416°N 0.1022°W /... 10
18 Kensington and Chelsea Y Royal Kensington and Chelsea London Borough Council Conservative The Town Hall, Hornton Street 4.68 155,594 51°30′07″N 0°11′41″W / 51.5020°N 0.1947°W /... 3
19 Kingston upon Thames Royal Kingston upon Thames London Borough Council Liberal Democrat Guildhall, High Street 14.38 166,793 51°24′31″N 0°18′23″W / 51.4085°N 0.3064°W /... 16
20 Lambeth Y Lambeth London Borough Council Labour Lambeth Town Hall, Brixton Hill 10.36 314,242 51°27′39″N 0°06′59″W / 51.4607°N 0.1163°W /... 6
21 Lewisham Y Lewisham London Borough Council Labour Town Hall, 1 Catford Road 13.57 286,180 51°26′43″N 0°01′15″W / 51.4452°N 0.0209°W /... 21
22 Merton Merton London Borough Council Labour Civic Centre, London Road 14.52 203,223 51°24′05″N 0°11′45″W / 51.4014°N 0.1958°W /... 17
23 Newham [note 3] Newham London Borough Council Labour Newham Dockside, 1000 Dockside Road 13.98 318,227 51°30′28″N 0°02′49″E / 51.5077°N 0.0469°E /... 27
24 Redbridge Redbridge London Borough Council Labour Town Hall, 128-142 High Road 21.78 288,272 51°33′32″N 0°04′27″E / 51.5590°N 0.0741°E /... 26
25 Richmond upon Thames Richmond upon Thames London Borough Council Liberal Democrat Civic Centre, 44 York Street 22.17 191,365 51°26′52″N 0°19′34″W / 51.4479°N 0.3260°W /... 15
26 Southwark Y Southwark London Borough Council Labour 160 Tooley Street 11.14 298,464 51°30′13″N 0°04′49″W / 51.5035°N 0.0804°W /... 7
27 Sutton Sutton London Borough Council Liberal Democrat Civic Offices, St Nicholas Way 16.93 195,914 51°21′42″N 0°11′40″W / 51.3618°N 0.1945°W /... 18
28 Tower Hamlets Y Tower Hamlets London Borough Council Labour Town Hall, Mulberry Place, 5 Clove Crescent 7.63 272,890 51°30′36″N 0°00′21″W / 51.5099°N 0.0059°W /... 8
29 Waltham Forest Waltham Forest London Borough Council Labour Waltham Forest Town Hall, Forest Road 14.99 265,797 51°35′27″N 0°00′48″W / 51.5908°N 0.0134°W /... 28
30 Wandsworth Y Wandsworth London Borough Council Conservative The Town Hall, Wandsworth High Street 13.23 310,516 51°27′24″N 0°11′28″W / 51.4567°N 0.1910°W /... 5
31 Westminster Y City Westminster City Council Conservative Westminster City Hall, 64 Victoria Street 8.29 226,841 51°29′50″N 0°08′14″W / 51.4973°N 0.1372°W /... 2
32 Borough Inner Status Local authority Political control Headquarters Area (sq mi) Population(2011 est) Co-ordinates Nr. inmap
33 City of London (Y)[note 5] Sui generis;City;Ceremonial county Corporation of London;Inner Temple;Middle Temple ? Guildhall 1.12 7,000 51°30′56″N 0°05′32″W / 51.5155°N 0.0922°W /... 1
In [94]:
# Create a df with just the columns needed and rename them appropriately
dfld = pd.DataFrame(dfl_input,columns=['Borough', 'Population (2013 est)[1]', 'Area (sq mi)'])
dfld.rename(columns={'Population (2013 est)[1]':'Population'}, inplace=True)
dfld.rename(columns={'Area (sq mi)':'Area'}, inplace=True)

# Strip unwanted text from df
dfld['Borough'] = dfld['Borough'].map(lambda x: x.rstrip(']'))
dfld['Borough'] = dfld['Borough'].str.replace('note','')
dfld['Borough'] = dfld['Borough'].map(lambda x: x.rstrip('123456789.'))
dfld['Borough'] = dfld['Borough'].map(lambda x: x.rstrip(' ['))
dfld['Population'] = dfld['Population'].str.replace(',','')

dfld
Out[94]:
Borough Population Area
0 Barking and Dagenham 194352 13.93
1 Barnet 369088 33.49
2 Bexley 236687 23.38
3 Brent 317264 16.70
4 Bromley 317899 57.97
5 Camden 229719 8.40
6 Croydon 372752 33.41
7 Ealing 342494 21.44
8 Enfield 320524 31.74
9 Greenwich 264008 18.28
10 Hackney 257379 7.36
11 Hammersmith and Fulham 178685 6.33
12 Haringey 263386 11.42
13 Harrow 243372 19.49
14 Havering 242080 43.35
15 Hillingdon 286806 44.67
16 Hounslow 262407 21.61
17 Islington 215667 5.74
18 Kensington and Chelsea 155594 4.68
19 Kingston upon Thames 166793 14.38
20 Lambeth 314242 10.36
21 Lewisham 286180 13.57
22 Merton 203223 14.52
23 Newham 318227 13.98
24 Redbridge 288272 21.78
25 Richmond upon Thames 191365 22.17
26 Southwark 298464 11.14
27 Sutton 195914 16.93
28 Tower Hamlets 272890 7.63
29 Waltham Forest 265797 14.99
30 Wandsworth 310516 13.23
31 Westminster 226841 8.29
32 Borough Population(2011 est) Area (sq mi)
33 City of London 7000 1.12
In [95]:
dfld.dtypes
Out[95]:
Borough       object
Population    object
Area          object
dtype: object
In [96]:
# Delete row with label 32 
dfld = dfld.drop([32], axis=0)
dfld = dfld.reset_index(drop = True)
In [97]:
dfld['Population'] = pd.to_numeric(dfld['Population'])
dfld['Area'] = pd.to_numeric(dfld['Area'])
dfld.dtypes
Out[97]:
Borough        object
Population      int64
Area          float64
dtype: object
In [98]:
dfld['Population / Area'] = dfld['Population']/dfld['Area']
pd.options.display.float_format = '{:,.0f}'.format
dfld
Out[98]:
Borough Population Area Population / Area
0 Barking and Dagenham 194352 14 13,952
1 Barnet 369088 33 11,021
2 Bexley 236687 23 10,123
3 Brent 317264 17 18,998
4 Bromley 317899 58 5,484
5 Camden 229719 8 27,348
6 Croydon 372752 33 11,157
7 Ealing 342494 21 15,975
8 Enfield 320524 32 10,098
9 Greenwich 264008 18 14,442
10 Hackney 257379 7 34,970
11 Hammersmith and Fulham 178685 6 28,228
12 Haringey 263386 11 23,064
13 Harrow 243372 19 12,487
14 Havering 242080 43 5,584
15 Hillingdon 286806 45 6,421
16 Hounslow 262407 22 12,143
17 Islington 215667 6 37,573
18 Kensington and Chelsea 155594 5 33,247
19 Kingston upon Thames 166793 14 11,599
20 Lambeth 314242 10 30,332
21 Lewisham 286180 14 21,089
22 Merton 203223 15 13,996
23 Newham 318227 14 22,763
24 Redbridge 288272 22 13,236
25 Richmond upon Thames 191365 22 8,632
26 Southwark 298464 11 26,792
27 Sutton 195914 17 11,572
28 Tower Hamlets 272890 8 35,765
29 Waltham Forest 265797 15 17,732
30 Wandsworth 310516 13 23,471
31 Westminster 226841 8 27,363
32 City of London 7000 1 6,250
In [99]:
# Sort by Population / Area
dfld.sort_values(by='Population / Area', inplace=True, ascending=False)
dfld
Out[99]:
Borough Population Area Population / Area
17 Islington 215667 6 37,573
28 Tower Hamlets 272890 8 35,765
10 Hackney 257379 7 34,970
18 Kensington and Chelsea 155594 5 33,247
20 Lambeth 314242 10 30,332
11 Hammersmith and Fulham 178685 6 28,228
31 Westminster 226841 8 27,363
5 Camden 229719 8 27,348
26 Southwark 298464 11 26,792
30 Wandsworth 310516 13 23,471
12 Haringey 263386 11 23,064
23 Newham 318227 14 22,763
21 Lewisham 286180 14 21,089
3 Brent 317264 17 18,998
29 Waltham Forest 265797 15 17,732
7 Ealing 342494 21 15,975
9 Greenwich 264008 18 14,442
22 Merton 203223 15 13,996
0 Barking and Dagenham 194352 14 13,952
24 Redbridge 288272 22 13,236
13 Harrow 243372 19 12,487
16 Hounslow 262407 22 12,143
19 Kingston upon Thames 166793 14 11,599
27 Sutton 195914 17 11,572
6 Croydon 372752 33 11,157
1 Barnet 369088 33 11,021
2 Bexley 236687 23 10,123
8 Enfield 320524 32 10,098
25 Richmond upon Thames 191365 22 8,632
15 Hillingdon 286806 45 6,421
32 City of London 7000 1 6,250
14 Havering 242080 43 5,584
4 Bromley 317899 58 5,484
Create a London population density map
In [104]:
# London latitude and longitude values
latitude = 51.509865
longitude = -0.118092
ldn_borough_geo = '/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./london_boroughs.json'

# Create map
ldnc_map = folium.Map(
       location=[latitude,longitude],
       zoom_start=12)

# Use json file
ldnc_map.choropleth(
       geo_data=ldn_borough_geo, # what is the name of the json file
       data=dfld, # where is the applicable data stored
       columns=['Borough', 'Population / Area'], # which columns in the df do you want to link to
       key_on='feature.properties.name', # this is according to the json file
       fill_color='YlOrRd',
       fill_opacity='0.5',
       line_opacity='0.4',
       legend_name='Population / Sq Mile in London, by Borough')

# display the London population density map
ldnc_map
Out[104]:
From the London data file and the chloropeth map its easy to identify the high population density areas

Get Wikipedia data for London Boroughs

In [63]:
# Import clean London Borough data from Wikipedia
wikipedia_link='https://en.wikipedia.org/wiki/List_of_London_boroughs#List_of_boroughs_and_local_authorities'

#Create a handle, wikipedia_page, to handle the contents of the website
wikipedia_page=requests.get(wikipedia_link)

#Store the contents of the website under wikipedia_page
wikipedia_page = lh.fromstring(wikipedia_page.content)

#Parse data that are stored between <tr>..</tr> of HTML
tr_elements = wikipedia_page.xpath('//tr')

#Check the length of the first 12 rows
[len(T) for T in tr_elements[:12]]
Out[63]:
[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
In [64]:
#Create empty list
col=[]

i=0
#For each row, store each first element (header) and an empty list
for t in tr_elements[0]:
    i+=1
    name=t.text_content()
    print(name)
    col.append((name,[]))
Borough

Inner

Status

Local authority

Political control

Headquarters

Area (sq mi)

Population (2013 est)[1]

Co-ordinates

 Nr. in map 

In [65]:
col
Out[65]:
[('Borough\n', []),
 ('Inner\n', []),
 ('Status\n', []),
 ('Local authority\n', []),
 ('Political control\n', []),
 ('Headquarters\n', []),
 ('Area (sq mi)\n', []),
 ('Population (2013 est)[1]\n', []),
 ('Co-ordinates\n', []),
 (' Nr. in map \n', [])]
In [66]:
#Since the first row is the header, data is stored on the second row onwards
for j in range(1,len(tr_elements)):
    #T is our j'th row
    T=tr_elements[j]
    
    #If row is not of size 10, the //tr data is not from our table 
    if len(T)!=10:
        break
    
    #i is the index of our column
    i=0
    
    #Iterate through each element of the row
    for t in T.iterchildren():
        data=t.text_content() 
        #Check if row is empty
        if i>0:
        #Convert any numerical value to integers
            try:
                data=int(data)
            except:
                pass
        #Append the data to the empty list of the i'th column
        col[i][1].append(data)
        #Increment i for the next column
        i+=1
In [67]:
[len(C) for (title,C) in col]
Out[67]:
[34, 34, 34, 34, 34, 34, 34, 34, 34, 34]
In [68]:
# Transforming the dictionary on to a dataframe
Dict={title:column for (title,column) in col}
dfl=pd.DataFrame(Dict)
In [69]:
# Cleaning break lines
dfl = dfl.replace(r'\n','', regex=True)
dfl.columns = ['Borough', 'Inner', 'Status', 'Local authority', 'Political control', 'Headquarters', 'Area (sq mi)', 'Population (2013 est)[1]', 'Co-ordinates', 'Nr. in map']
dfl.head()
Out[69]:
Borough Inner Status Local authority Political control Headquarters Area (sq mi) Population (2013 est)[1] Co-ordinates Nr. in map
0 Barking and Dagenham [note 1] Barking and Dagenham London Borough Council Labour Town Hall, 1 Town Square 13.93 194,352 51°33′39″N 0°09′21″E / 51.5607°N 0.1557°E /... 25
1 Barnet Barnet London Borough Council Conservative Barnet House, 2 Bristol Avenue, Colindale 33.49 369,088 51°37′31″N 0°09′06″W / 51.6252°N 0.1517°W /... 31
2 Bexley Bexley London Borough Council Conservative Civic Offices, 2 Watling Street 23.38 236,687 51°27′18″N 0°09′02″E / 51.4549°N 0.1505°E /... 23
3 Brent Brent London Borough Council Labour Brent Civic Centre, Engineers Way 16.70 317,264 51°33′32″N 0°16′54″W / 51.5588°N 0.2817°W /... 12
4 Bromley Bromley London Borough Council Conservative Civic Centre, Stockwell Close 57.97 317,899 51°24′14″N 0°01′11″E / 51.4039°N 0.0198°E /... 20
In [70]:
# Create a new df of just the columns that we need
dfldn = dfl.iloc[:, [0, 8]]
In [71]:
# Delete row with label 32 
dfldn = dfldn.drop([32], axis=0)
In [72]:
# Preview last 5 rows to confirm that row 32 was deleted
dfldn.tail(5)
Out[72]:
Borough Co-ordinates
28 Tower Hamlets 51°30′36″N 0°00′21″W / 51.5099°N 0.0059°W /...
29 Waltham Forest 51°35′27″N 0°00′48″W / 51.5908°N 0.0134°W /...
30 Wandsworth 51°27′24″N 0°11′28″W / 51.4567°N 0.1910°W /...
31 Westminster 51°29′50″N 0°08′14″W / 51.4973°N 0.1372°W /...
33 City of London 51°30′56″N 0°05′32″W / 51.5155°N 0.0922°W /...
In [73]:
dfldn.head(5)
Out[73]:
Borough Co-ordinates
0 Barking and Dagenham [note 1] 51°33′39″N 0°09′21″E / 51.5607°N 0.1557°E /...
1 Barnet 51°37′31″N 0°09′06″W / 51.6252°N 0.1517°W /...
2 Bexley 51°27′18″N 0°09′02″E / 51.4549°N 0.1505°E /...
3 Brent 51°33′32″N 0°16′54″W / 51.5588°N 0.2817°W /...
4 Bromley 51°24′14″N 0°01′11″E / 51.4039°N 0.0198°E /...
In [74]:
# Strip unwanted text from df
dfldn['Borough'] = dfldn['Borough'].map(lambda x: x.rstrip(']'))
dfldn['Borough'] = dfldn['Borough'].str.replace('note','')
dfldn['Borough'] = dfldn['Borough'].map(lambda x: x.rstrip('123456789.'))
dfldn['Borough'] = dfldn['Borough'].map(lambda x: x.rstrip(' ['))
dfldn.head(5)
Out[74]:
Borough Co-ordinates
0 Barking and Dagenham 51°33′39″N 0°09′21″E / 51.5607°N 0.1557°E /...
1 Barnet 51°37′31″N 0°09′06″W / 51.6252°N 0.1517°W /...
2 Bexley 51°27′18″N 0°09′02″E / 51.4549°N 0.1505°E /...
3 Brent 51°33′32″N 0°16′54″W / 51.5588°N 0.2817°W /...
4 Bromley 51°24′14″N 0°01′11″E / 51.4039°N 0.0198°E /...
In [75]:
# Strip the coordinates data
dfldn[['Co-ordinates1', 'Co-ordinates2', 'Co-ordinates3']] = dfldn['Co-ordinates'].str.split('/', expand=True)
dfldn.head(5)
Out[75]:
Borough Co-ordinates Co-ordinates1 Co-ordinates2 Co-ordinates3
0 Barking and Dagenham 51°33′39″N 0°09′21″E / 51.5607°N 0.1557°E /... 51°33′39″N 0°09′21″E 51.5607°N 0.1557°E 51.5607; 0.1557 (Barking and Dagenham)
1 Barnet 51°37′31″N 0°09′06″W / 51.6252°N 0.1517°W /... 51°37′31″N 0°09′06″W 51.6252°N 0.1517°W 51.6252; -0.1517 (Barnet)
2 Bexley 51°27′18″N 0°09′02″E / 51.4549°N 0.1505°E /... 51°27′18″N 0°09′02″E 51.4549°N 0.1505°E 51.4549; 0.1505 (Bexley)
3 Brent 51°33′32″N 0°16′54″W / 51.5588°N 0.2817°W /... 51°33′32″N 0°16′54″W 51.5588°N 0.2817°W 51.5588; -0.2817 (Brent)
4 Bromley 51°24′14″N 0°01′11″E / 51.4039°N 0.0198°E /... 51°24′14″N 0°01′11″E 51.4039°N 0.0198°E 51.4039; 0.0198 (Bromley)
In [76]:
# Will use Co-ordinates 3 as cleanest data
# Include Latitude and Longitude columns and strip data from co-ordinate3
dfldn[['Latitude', 'Longitude']] = dfldn['Co-ordinates3'].str.split(';', expand=True)
dfldn.head(5)
Out[76]:
Borough Co-ordinates Co-ordinates1 Co-ordinates2 Co-ordinates3 Latitude Longitude
0 Barking and Dagenham 51°33′39″N 0°09′21″E / 51.5607°N 0.1557°E /... 51°33′39″N 0°09′21″E 51.5607°N 0.1557°E 51.5607; 0.1557 (Barking and Dagenham) 51.5607 0.1557 (Barking and Dagenham)
1 Barnet 51°37′31″N 0°09′06″W / 51.6252°N 0.1517°W /... 51°37′31″N 0°09′06″W 51.6252°N 0.1517°W 51.6252; -0.1517 (Barnet) 51.6252 -0.1517 (Barnet)
2 Bexley 51°27′18″N 0°09′02″E / 51.4549°N 0.1505°E /... 51°27′18″N 0°09′02″E 51.4549°N 0.1505°E 51.4549; 0.1505 (Bexley) 51.4549 0.1505 (Bexley)
3 Brent 51°33′32″N 0°16′54″W / 51.5588°N 0.2817°W /... 51°33′32″N 0°16′54″W 51.5588°N 0.2817°W 51.5588; -0.2817 (Brent) 51.5588 -0.2817 (Brent)
4 Bromley 51°24′14″N 0°01′11″E / 51.4039°N 0.0198°E /... 51°24′14″N 0°01′11″E 51.4039°N 0.0198°E 51.4039; 0.0198 (Bromley) 51.4039 0.0198 (Bromley)
In [77]:
# Clean longitude column by including new colume names
dfldn[['Longitude a', 'Name']] = dfldn['Longitude'].str.split('(', expand=True)
dfldn.head(5)
Out[77]:
Borough Co-ordinates Co-ordinates1 Co-ordinates2 Co-ordinates3 Latitude Longitude Longitude a Name
0 Barking and Dagenham 51°33′39″N 0°09′21″E / 51.5607°N 0.1557°E /... 51°33′39″N 0°09′21″E 51.5607°N 0.1557°E 51.5607; 0.1557 (Barking and Dagenham) 51.5607 0.1557 (Barking and Dagenham) 0.1557 Barking and Dagenham)
1 Barnet 51°37′31″N 0°09′06″W / 51.6252°N 0.1517°W /... 51°37′31″N 0°09′06″W 51.6252°N 0.1517°W 51.6252; -0.1517 (Barnet) 51.6252 -0.1517 (Barnet) -0.1517 Barnet)
2 Bexley 51°27′18″N 0°09′02″E / 51.4549°N 0.1505°E /... 51°27′18″N 0°09′02″E 51.4549°N 0.1505°E 51.4549; 0.1505 (Bexley) 51.4549 0.1505 (Bexley) 0.1505 Bexley)
3 Brent 51°33′32″N 0°16′54″W / 51.5588°N 0.2817°W /... 51°33′32″N 0°16′54″W 51.5588°N 0.2817°W 51.5588; -0.2817 (Brent) 51.5588 -0.2817 (Brent) -0.2817 Brent)
4 Bromley 51°24′14″N 0°01′11″E / 51.4039°N 0.0198°E /... 51°24′14″N 0°01′11″E 51.4039°N 0.0198°E 51.4039; 0.0198 (Bromley) 51.4039 0.0198 (Bromley) 0.0198 Bromley)
In [78]:
# drop unneccesary columns
dfldn.drop(labels=['Co-ordinates', 'Co-ordinates1', 'Co-ordinates2', 'Co-ordinates3', 'Longitude', 'Name'], axis=1, inplace=True)
dfldn.head(5)
Out[78]:
Borough Latitude Longitude a
0 Barking and Dagenham 51.5607 0.1557
1 Barnet 51.6252 -0.1517
2 Bexley 51.4549 0.1505
3 Brent 51.5588 -0.2817
4 Bromley 51.4039 0.0198
In [79]:
# Rename column name 
dfldn.rename(columns={'Longitude a':'Longitude'}, inplace=True)
In [80]:
# Clean the Longitude column from all abnormal data
dfldn['Longitude'] = dfldn['Longitude'].map(lambda x: x.rstrip('\ufeff '))
In [81]:
# Print clean LDN Borough geographic data frame
dfldn.head(5)
Out[81]:
Borough Latitude Longitude
0 Barking and Dagenham 51.5607 0.1557
1 Barnet 51.6252 -0.1517
2 Bexley 51.4549 0.1505
3 Brent 51.5588 -0.2817
4 Bromley 51.4039 0.0198
In [82]:
# Confirm data types
dfldn.dtypes
Out[82]:
Borough      object
Latitude     object
Longitude    object
dtype: object
In [83]:
# Change dtypes of Lat & Lon columns to numeric values
dfldn["Longitude"] = dfldn.Longitude.astype(float)
dfldn["Latitude"] = dfldn.Latitude.astype(float)
dfldn.head(5)
Out[83]:
Borough Latitude Longitude
0 Barking and Dagenham 51.56 0.16
1 Barnet 51.63 -0.15
2 Bexley 51.45 0.15
3 Brent 51.56 -0.28
4 Bromley 51.40 0.02
In [84]:
dfldn.dtypes
Out[84]:
Borough       object
Latitude     float64
Longitude    float64
dtype: object

Create a borough map of London

In [105]:
# Get co-ordinates for London
address = 'London, UK'

geolocator = Nominatim(user_agent="london_research")
location = geolocator.geocode(address)
latitude = location.latitude
longitude = location.longitude

print('The geographical coordinates for the City of london are {}, {}.'.format(latitude, longitude))
The geographical coordinates for the City of london are 51.5073219, -0.1276474.
In [106]:
# London latitude and longitude values (51.5073219° N, -0.1276474° W)
latitude = 51.5073219
longitude = -0.1276474
In [107]:
# create map of all the boroughs in London and display it
map = folium.Map(location=[latitude, longitude], zoom_start=10)

# add markers to the map
for lat, lng, borough in zip(dfldn['Latitude'], dfldn['Longitude'], dfldn['Borough']):
    label = '{}'.format(borough)
    folium.CircleMarker(
        [lat, lng],
        radius=5,
        color='blue',
        fill=True,
        fill_color='#318cc',
        fill_opacity=0.7).add_to(map)
    
map
Out[107]:

4) Establish on which London boroughs the coffee market is focused

Get Foursquare data - Coffee shops in City of London

In [108]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
In [109]:
# Create a London geolocator
address = 'London, UK'

geolocator = Nominatim(user_agent="foursquare_agent")
location = geolocator.geocode(address)
latitude = location.latitude
longitude = location.longitude
print(latitude, longitude)
51.5073219 -0.1276474
In [110]:
# Create a search query for coffee shops within a xxm radius of the london centre
search_query = 'Coffee'
radius = 5000
limit = 500
print(search_query + ' .... OK!')
Coffee .... OK!

Define the corresponding URL

In [111]:
url = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, latitude, longitude, VERSION, search_query, radius, limit)
url
Out[111]:
'https://api.foursquare.com/v2/venues/search?client_id=ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD&client_secret=1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ&ll=51.5073219,-0.1276474&v=20180604&query=Coffee&radius=5000&limit=500'

Send the GET Request and examine the results

In [112]:
results = requests.get(url).json()
results
Out[112]:
{'meta': {'code': 200, 'requestId': '5ecfe85de826ac001b41dae8'},
 'response': {'venues': [{'id': '4b4b47f5f964a520609626e3',
    'name': 'Costa Coffee',
    'location': {'address': 'The Grand Building',
     'crossStreet': 'Trafalgar Square',
     'lat': 51.507644428472375,
     'lng': -0.1270757830083151,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.507644428472375,
       'lng': -0.1270757830083151}],
     'distance': 53,
     'postalCode': 'WC2N 5EJ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['The Grand Building (Trafalgar Square)',
      'London',
      'Greater London',
      'WC2N 5EJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4cda944022bd721e533df047',
    'name': 'Costa Coffee',
    'location': {'address': '15 Regent St',
     'crossStreet': 'Jermyn St',
     'lat': 51.50879033505443,
     'lng': -0.13388720503979742,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50879033505443,
       'lng': -0.13388720503979742}],
     'distance': 462,
     'postalCode': 'SW1Y 4LR',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['15 Regent St (Jermyn St)',
      'London',
      'Greater London',
      'SW1Y 4LR',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4ae815e0f964a52014ae21e3',
    'name': 'Costa Coffee',
    'location': {'address': '17 Embankment Pl',
     'lat': 51.50730858076348,
     'lng': -0.12279268681923348,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50730858076348,
       'lng': -0.12279268681923348}],
     'distance': 336,
     'postalCode': 'WC2N 6NN',
     'cc': 'GB',
     'neighborhood': 'Embankmen',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['17 Embankment Pl',
      'London',
      'Greater London',
      'WC2N 6NN',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b24fad1f964a520f66a24e3',
    'name': 'Costa Coffee',
    'location': {'address': '13 New Row',
     'lat': 51.51115239980299,
     'lng': -0.1256779215913941,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51115239980299,
       'lng': -0.1256779215913941}],
     'distance': 447,
     'postalCode': 'WC2N 4LF',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['13 New Row',
      'London',
      'Greater London',
      'WC2N 4LF',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4c7f554fd51ea143cc5e5a9f',
    'name': 'Costa Coffee',
    'location': {'address': '9-11 Kingsway',
     'lat': 51.51359089480928,
     'lng': -0.1178481570622197,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51359089480928,
       'lng': -0.1178481570622197}],
     'distance': 973,
     'postalCode': 'WC2B 6UN',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['9-11 Kingsway',
      'London',
      'Greater London',
      'WC2B 6UN',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b6fc85bf964a52069fc2ce3',
    'name': 'AMT Coffee',
    'location': {'address': 'St. Thomas Hospital',
     'crossStreet': 'Lambeth Palace Road',
     'lat': 51.49997320903263,
     'lng': -0.11897431613749751,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49997320903263,
       'lng': -0.11897431613749751}],
     'distance': 1015,
     'postalCode': 'SE1 7EH',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['St. Thomas Hospital (Lambeth Palace Road)',
      'London',
      'Greater London',
      'SE1 7EH',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '596e24c212c8f014009d6842',
    'name': 'Soho Coffee company',
    'location': {'address': '65 Kingsway',
     'lat': 51.51537503662551,
     'lng': -0.11906732155337466,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51537503662551,
       'lng': -0.11906732155337466}],
     'distance': 1075,
     'postalCode': 'WC2B 6TD',
     'cc': 'GB',
     'neighborhood': 'Holborn and Covent Garden',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['65 Kingsway',
      'London',
      'Greater London',
      'WC2B 6TD',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b2630f7f964a5200a7924e3',
    'name': 'Costa Coffee',
    'location': {'address': '200 Piccadilly',
     'lat': 51.50896578159291,
     'lng': -0.13658616852203312,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50896578159291,
       'lng': -0.13658616852203312}],
     'distance': 645,
     'postalCode': 'W1J 9HU',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['200 Piccadilly',
      'London',
      'Greater London',
      'W1J 9HU',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4aeebda6f964a52038d421e3',
    'name': 'Algerian Coffee Stores',
    'location': {'address': '52 Old Compton St',
     'lat': 51.51286473760223,
     'lng': -0.132083758630985,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51286473760223,
       'lng': -0.132083758630985}],
     'distance': 689,
     'postalCode': 'W1D 4PB',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['52 Old Compton St',
      'London',
      'Greater London',
      'W1D 4PB',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4d7b8859645ea35daeb133f8',
    'name': 'Costa Coffee',
    'location': {'address': '39 Shelton St',
     'lat': 51.514071861530866,
     'lng': -0.12476381471489859,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.514071861530866,
       'lng': -0.12476381471489859}],
     'distance': 777,
     'postalCode': 'WC2H 9HJ',
     'cc': 'GB',
     'city': 'Covent Garden',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['39 Shelton St',
      'Covent Garden',
      'Greater London',
      'WC2H 9HJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4cac1b4d36fa6dcb80e6db78',
    'name': 'Despatch Box Coffee Shop',
    'location': {'address': 'Portcullis House',
     'lat': 51.50111406437572,
     'lng': -0.12474325755695803,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50111406437572,
       'lng': -0.12474325755695803}],
     'distance': 719,
     'postalCode': 'SW1 A 2',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Portcullis House',
      'London',
      'Greater London',
      'SW1 A 2',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '551a93a2498ed90a2cc7e544',
    'name': 'Department of Coffee and Social Affairs',
    'location': {'address': '15 Sherwood St',
     'crossStreet': 'Regent St Quadrant',
     'lat': 51.51087965006803,
     'lng': -0.13587449918057187,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51087965006803,
       'lng': -0.13587449918057187}],
     'distance': 694,
     'postalCode': 'W1F 7ED',
     'cc': 'GB',
     'neighborhood': 'Piccadilly, London, Greater London',
     'city': 'Soho',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['15 Sherwood St (Regent St Quadrant)',
      'Soho',
      'Greater London',
      'W1F 7ED',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b7d4467f964a52082b52fe3',
    'name': 'Double Shot Coffee Co.',
    'location': {'address': '38 Tavistock St',
     'lat': 51.512287,
     'lng': -0.120176,
     'distance': 757,
     'postalCode': 'WC2E 7PB',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['38 Tavistock St',
      'London',
      'Greater London',
      'WC2E 7PB',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b817ecef964a52033aa30e3',
    'name': 'AMT Coffee',
    'location': {'address': '16 Neal Street',
     'lat': 51.51370664977727,
     'lng': -0.12480324765665209,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51370664977727,
       'lng': -0.12480324765665209}],
     'distance': 737,
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['16 Neal Street',
      'London',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4ac518edf964a520c1ac20e3',
    'name': 'Monmouth Coffee Company',
    'location': {'address': '27 Monmouth St',
     'lat': 51.514314,
     'lng': -0.126824,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.514314,
       'lng': -0.126824}],
     'distance': 780,
     'postalCode': 'WC2H 9EU',
     'cc': 'GB',
     'neighborhood': 'Holborn and Covent Garden',
     'city': 'Covent Garden',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['27 Monmouth St',
      'Covent Garden',
      'Greater London',
      'WC2H 9EU',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '5a6dfdcf48b04e70ed5493b5',
    'name': 'Hej Coffee',
    'location': {'address': 'Strand',
     'lat': 51.511265,
     'lng': -0.117505,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.511265,
       'lng': -0.117505}],
     'distance': 828,
     'postalCode': 'W C2R',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Strand',
      'London',
      'Greater London',
      'W C2R',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '553e368d498ecddb31302a1c',
    'name': 'Crosstown Doughnuts & Coffee',
    'location': {'address': '4 Broadwick St',
     'lat': 51.514042566300574,
     'lng': -0.1346042713774741,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.514042566300574,
       'lng': -0.1346042713774741}],
     'distance': 889,
     'postalCode': 'W1F 8HJ',
     'cc': 'GB',
     'neighborhood': 'Soho, London, Greater London',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['4 Broadwick St',
      'London',
      'Greater London',
      'W1F 8HJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d148941735',
      'name': 'Donut Shop',
      'pluralName': 'Donut Shops',
      'shortName': 'Donuts',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/donuts_',
       'suffix': '.png'},
      'primary': True}],
    'venuePage': {'id': '127184114'},
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '5565c24d498e2885d1b9a54e',
    'name': 'Coffee Geek and Friends',
    'location': {'address': 'Unit 22 Cardinal Place',
     'crossStreet': '6 Cathedral Walk',
     'lat': 51.497637766011685,
     'lng': -0.14152261249881912,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.497637766011685,
       'lng': -0.14152261249881912}],
     'distance': 1444,
     'postalCode': 'SW1E 5JH',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Unit 22 Cardinal Place (6 Cathedral Walk)',
      'London',
      'Greater London',
      'SW1E 5JH',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '56d44205cd10603392e9101e',
    'name': 'Press Coffee & Co.',
    'location': {'address': '81 Chancery Ln',
     'lat': 51.515798,
     'lng': -0.111963,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.515798,
       'lng': -0.111963}],
     'distance': 1439,
     'postalCode': 'WC2A 1DD',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['81 Chancery Ln',
      'London',
      'Greater London',
      'WC2A 1DD',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '5242cbc411d25ddcbaf84656',
    'name': 'The Somerset Coffee Bar',
    'location': {'address': 'Strand Campus',
     'lat': 51.51137166465521,
     'lng': -0.11618093324612834,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51137166465521,
       'lng': -0.11618093324612834}],
     'distance': 913,
     'postalCode': 'WC2R 2LS',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Strand Campus',
      'London',
      'Greater London',
      'WC2R 2LS',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1a1941735',
      'name': 'College Cafeteria',
      'pluralName': 'College Cafeterias',
      'shortName': 'Cafeteria',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/education/cafeteria_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '574ee1f9498ebb08c52ff8cb',
    'name': 'Costa Coffee',
    'location': {'address': '76-78 Upper Ground',
     'lat': 51.507765649093464,
     'lng': -0.11332702409990071,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.507765649093464,
       'lng': -0.11332702409990071}],
     'distance': 993,
     'postalCode': 'SE1 9PZ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['76-78 Upper Ground',
      'London',
      'Greater London',
      'SE1 9PZ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '50b282aae4b0dabb590f2fbe',
    'name': 'Costa Coffee',
    'location': {'address': '1 Charlie Chaplin Walk',
     'crossStreet': 'at Waterloo Rd',
     'lat': 51.50476681331239,
     'lng': -0.11352908168467384,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50476681331239,
       'lng': -0.11352908168467384}],
     'distance': 1018,
     'postalCode': 'SE1 1XR',
     'cc': 'GB',
     'city': 'Waterloo',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['1 Charlie Chaplin Walk (at Waterloo Rd)',
      'Waterloo',
      'Greater London',
      'SE1 1XR',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4c5e9aaf9b28d13a44c35c70',
    'name': 'Costa Coffee',
    'location': {'address': '3 Cardinal Walk',
     'crossStreet': 'Victoria St',
     'lat': 51.49707313663782,
     'lng': -0.1413876188745272,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49707313663782,
       'lng': -0.1413876188745272}],
     'distance': 1485,
     'postalCode': 'SW1E 5JE',
     'cc': 'GB',
     'city': 'Victoria',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['3 Cardinal Walk (Victoria St)',
      'Victoria',
      'Greater London',
      'SW1E 5JE',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4ad204d6f964a520dfde20e3',
    'name': 'The Old Coffee House',
    'location': {'address': '49 Beak St',
     'lat': 51.51262085770566,
     'lng': -0.13734527426043697,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51262085770566,
       'lng': -0.13734527426043697}],
     'distance': 894,
     'postalCode': 'W1F 9SF',
     'cc': 'GB',
     'city': 'Soho',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['49 Beak St',
      'Soho',
      'Greater London',
      'W1F 9SF',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d11b941735',
      'name': 'Pub',
      'pluralName': 'Pubs',
      'shortName': 'Pub',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/nightlife/pub_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '58e50bd73ef0f646864352dd',
    'name': 'Better Coffee Corner',
    'location': {'address': 'Oasis Sports Centre, 32 Endell St',
     'lat': 51.515705,
     'lng': -0.125915,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.515705,
       'lng': -0.125915}],
     'distance': 940,
     'postalCode': 'WC2H 9AG',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Oasis Sports Centre, 32 Endell St',
      'London',
      'Greater London',
      'WC2H 9AG',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4cc2c86b8062468853762b2f',
    'name': 'Soho Coffee Club',
    'location': {'address': 'Dean St',
     'lat': 51.51527327636101,
     'lng': -0.1336811850511561,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51527327636101,
       'lng': -0.1336811850511561}],
     'distance': 978,
     'cc': 'GB',
     'city': 'Soho',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Dean St',
      'Soho',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d16d941735',
      'name': 'Café',
      'pluralName': 'Cafés',
      'shortName': 'Café',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/cafe_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '5883913551d19e062a758a77',
    'name': "Ralph's Coffee & Bar",
    'location': {'address': '173 Regent Street',
     'lat': 51.51214764828749,
     'lng': -0.140224315955928,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51214764828749,
       'lng': -0.140224315955928}],
     'distance': 1023,
     'postalCode': 'W1B 4JQ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['173 Regent Street',
      'London',
      'Greater London',
      'W1B 4JQ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d16d941735',
      'name': 'Café',
      'pluralName': 'Cafés',
      'shortName': 'Café',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/cafe_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4f7ac16fe4b0e4c448e2a05b',
    'name': 'Notes Coffee Barrows',
    'location': {'address': '60 St Giles High St',
     'lat': 51.51553615403286,
     'lng': -0.1286883752591523,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51553615403286,
       'lng': -0.1286883752591523}],
     'distance': 917,
     'postalCode': 'WC2H 8LG',
     'cc': 'GB',
     'city': 'Greater London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['60 St Giles High St',
      'Greater London',
      'WC2H 8LG',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '5221d93b11d2750f339082be',
    'name': 'Sharps Coffee Bar',
    'location': {'address': '9 Windmill St',
     'lat': 51.518808904913094,
     'lng': -0.1340059711003608,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.518808904913094,
       'lng': -0.1340059711003608}],
     'distance': 1352,
     'postalCode': 'W1T 2JF',
     'cc': 'GB',
     'city': 'Fitzrovia',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['9 Windmill St',
      'Fitzrovia',
      'Greater London',
      'W1T 2JF',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '5082d072e4b09e409c582ab4',
    'name': 'TAP Coffee No. 193',
    'location': {'address': '193 Wardour St',
     'crossStreet': 'btwn Oxford St & Noel St',
     'lat': 51.51550905,
     'lng': -0.13578831,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51550905,
       'lng': -0.13578831}],
     'distance': 1071,
     'postalCode': 'W1F 8ZF',
     'cc': 'GB',
     'city': 'Soho',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['193 Wardour St (btwn Oxford St & Noel St)',
      'Soho',
      'Greater London',
      'W1F 8ZF',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b9bc455f964a520da2236e3',
    'name': 'Costa Coffee',
    'location': {'address': 'London Waterloo Station (WAT)',
     'crossStreet': 'Opposite Platform 11',
     'lat': 51.50318004562804,
     'lng': -0.11264348734111061,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50318004562804,
       'lng': -0.11264348734111061}],
     'distance': 1137,
     'postalCode': 'SE1 8SW',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['London Waterloo Station (WAT) (Opposite Platform 11)',
      'London',
      'Greater London',
      'SE1 8SW',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b25316df964a520b96d24e3',
    'name': 'Costa Coffee',
    'location': {'address': '11 Argyll St',
     'lat': 51.51475276642239,
     'lng': -0.14090585711763323,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51475276642239,
       'lng': -0.14090585711763323}],
     'distance': 1236,
     'postalCode': 'W1F 7TX',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['11 Argyll St',
      'London',
      'Greater London',
      'W1F 7TX',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4c3d6ed94bc9a5939b07d471',
    'name': 'Costa Coffee',
    'location': {'address': '4 Great Portland St',
     'lat': 51.51573111967288,
     'lng': -0.14068655684295295,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51573111967288,
       'lng': -0.14068655684295295}],
     'distance': 1300,
     'postalCode': 'W1W 8QJ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['4 Great Portland St',
      'London',
      'Greater London',
      'W1W 8QJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b0c6aa1f964a520cd3c23e3',
    'name': 'Flat Cap Coffee Co',
    'location': {'address': '4 Strutton Ground',
     'crossStreet': 'at Old Pye St',
     'lat': 51.49749647419568,
     'lng': -0.13385812172317216,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49749647419568,
       'lng': -0.13385812172317216}],
     'distance': 1175,
     'postalCode': 'SW1P 2HR',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['4 Strutton Ground (at Old Pye St)',
      'London',
      'Greater London',
      'SW1P 2HR',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b5201d2f964a520d96027e3',
    'name': 'Coffee Republic',
    'location': {'address': '2 South Molton St',
     'lat': 51.51460380934164,
     'lng': -0.14695511355036195,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51460380934164,
       'lng': -0.14695511355036195}],
     'distance': 1564,
     'postalCode': 'W1K 5QA',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['2 South Molton St',
      'London',
      'Greater London',
      'W1K 5QA',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4ba0a226f964a520237537e3',
    'name': 'Costa Coffee',
    'location': {'address': '226 High Holborn',
     'crossStreet': 'at Kingsway',
     'lat': 51.517563,
     'lng': -0.120121725,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.517563,
       'lng': -0.120121725}],
     'distance': 1253,
     'postalCode': 'WC1V 7DZ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['226 High Holborn (at Kingsway)',
      'London',
      'Greater London',
      'WC1V 7DZ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4e143ca37d8b4c0d630c715b',
    'name': 'Department of Coffee and Social Affairs',
    'location': {'address': '114 Tottenham Ct Rd',
     'crossStreet': 'at Midford Pl',
     'lat': 51.52339592535782,
     'lng': -0.13696752132571743,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52339592535782,
       'lng': -0.13696752132571743}],
     'distance': 1902,
     'postalCode': 'W1T 5AH',
     'cc': 'GB',
     'city': 'Bloomsbury',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['114 Tottenham Ct Rd (at Midford Pl)',
      'Bloomsbury',
      'Greater London',
      'W1T 5AH',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '53384902498e0f1c0982f993',
    'name': 'Coffee on Ground',
    'location': {'address': 'Debenhams',
     'crossStreet': '334-348 Oxford St',
     'lat': 51.515263,
     'lng': -0.148553,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.515263,
       'lng': -0.148553}],
     'distance': 1696,
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Debenhams (334-348 Oxford St)',
      'London',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '5ab688ff037be12b6480737e',
    'name': "Rachel's Nails & Coffee",
    'location': {'address': '34 Windmill Street',
     'lat': 51.518882,
     'lng': -0.133927,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.518882,
       'lng': -0.133927}],
     'distance': 1358,
     'postalCode': 'W1T 2JR',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['34 Windmill Street',
      'London',
      'Greater London',
      'W1T 2JR',
      'United Kingdom']},
    'categories': [{'id': '4f04aa0c2fb6e1c99f3db0b8',
      'name': 'Nail Salon',
      'pluralName': 'Nail Salons',
      'shortName': 'Nail Salon',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/shops/nailsalon_',
       'suffix': '.png'},
      'primary': True}],
    'venuePage': {'id': '543697886'},
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4ad9a8acf964a5205f1a21e3',
    'name': 'Monmouth Coffee Company',
    'location': {'address': '2 Park St',
     'crossStreet': 'The Borough',
     'lat': 51.505536,
     'lng': -0.09148,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.505536,
       'lng': -0.09148}],
     'distance': 2513,
     'postalCode': 'SE1 9AB',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['2 Park St (The Borough)',
      'London',
      'Greater London',
      'SE1 9AB',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4e9fe923b634b81226148799',
    'name': 'International Coffee Organization',
    'location': {'address': '22 Berners St',
     'lat': 51.517789676165556,
     'lng': -0.1368248462677002,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.517789676165556,
       'lng': -0.1368248462677002}],
     'distance': 1327,
     'postalCode': 'W1T 3DD',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['22 Berners St',
      'London',
      'Greater London',
      'W1T 3DD',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d124941735',
      'name': 'Office',
      'pluralName': 'Offices',
      'shortName': 'Office',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/building/default_',
       'suffix': '.png'},
      'primary': True}],
    'venuePage': {'id': '80040026'},
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4d09d8ce33d6b60ce15f9785',
    'name': 'Coffee Republic',
    'location': {'address': '99 Tottenham Court Rd',
     'lat': 51.522287105230085,
     'lng': -0.1359441657958477,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.522287105230085,
       'lng': -0.1359441657958477}],
     'distance': 1762,
     'postalCode': 'W1T 4TS',
     'cc': 'GB',
     'city': 'Fitzrovia',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['99 Tottenham Court Rd',
      'Fitzrovia',
      'Greater London',
      'W1T 4TS',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4d749547d0c737046217f217',
    'name': "Igor's Coffee",
    'location': {'address': 'Old St',
     'lat': 51.508269281074654,
     'lng': -0.11135127818307992,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.508269281074654,
       'lng': -0.11135127818307992}],
     'distance': 1134,
     'cc': 'GB',
     'neighborhood': 'Shoreditch, London, Greater London',
     'city': 'Shoreditch',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Old St',
      'Shoreditch',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1cb941735',
      'name': 'Food Truck',
      'pluralName': 'Food Trucks',
      'shortName': 'Food Truck',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/streetfood_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4e7c4d38183853fb9f712dcb',
    'name': '2 Love Tea And Coffee',
    'location': {'address': 'Lambeth Palace Rd',
     'lat': 51.49608859432227,
     'lng': -0.1208228442967082,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49608859432227,
       'lng': -0.1208228442967082}],
     'distance': 1336,
     'postalCode': 'SE1',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Lambeth Palace Rd',
      'London',
      'Greater London',
      ' SE1',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4e8ac70a8b810d8892781ae2',
    'name': 'Notes Coffee Barrows',
    'location': {'address': '186a Fleet St',
     'lat': 51.51409489806739,
     'lng': -0.1099574249329363,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51409489806739,
       'lng': -0.1099574249329363}],
     'distance': 1438,
     'postalCode': 'EC4A 2HR',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['186a Fleet St',
      'London',
      'Greater London',
      'EC4A 2HR',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4b9fae0bf964a5203e3437e3',
    'name': 'Costa Coffee',
    'location': {'address': '311-318 High Holborn',
     'lat': 51.51828657519206,
     'lng': -0.11303394786584942,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51828657519206,
       'lng': -0.11303394786584942}],
     'distance': 1585,
     'postalCode': 'WC1V 7BB',
     'cc': 'GB',
     'city': 'Greater London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['311-318 High Holborn',
      'Greater London',
      'WC1V 7BB',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4cfa6667ee9cb60c44fd89ad',
    'name': 'Department of Coffee and Social Affairs',
    'location': {'address': '14-16 Leather Ln',
     'lat': 51.519318453916654,
     'lng': -0.10918546578955386,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.519318453916654,
       'lng': -0.10918546578955386}],
     'distance': 1849,
     'postalCode': 'EC1N 7SU',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['14-16 Leather Ln',
      'London',
      'Greater London',
      'EC1N 7SU',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4c99dc8ba004a1cd8dee426e',
    'name': 'Coffee, Cake & Kink HQ',
    'location': {'address': '38 Mount Pleasant',
     'lat': 51.52234330631439,
     'lng': -0.11277070007291216,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52234330631439,
       'lng': -0.11277070007291216}],
     'distance': 1964,
     'postalCode': 'WC1X 0AN',
     'cc': 'GB',
     'city': 'Camden Town',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['38 Mount Pleasant',
      'Camden Town',
      'Greater London',
      'WC1X 0AN',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d124941735',
      'name': 'Office',
      'pluralName': 'Offices',
      'shortName': 'Office',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/building/default_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4bc9c597b6c49c74bce88e91',
    'name': 'Costa Coffee',
    'location': {'address': '82 Gower St',
     'crossStreet': 'in Waterstones',
     'lat': 51.522230614848795,
     'lng': -0.13233472532684573,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.522230614848795,
       'lng': -0.13233472532684573}],
     'distance': 1691,
     'postalCode': 'WC1E 6EQ',
     'cc': 'GB',
     'city': 'Camden Town',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['82 Gower St (in Waterstones)',
      'Camden Town',
      'Greater London',
      'WC1E 6EQ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False},
   {'id': '4d5d33e3fb186dcb4030099b',
    'name': 'Prufrock Coffee',
    'location': {'address': '23-25 Leather Ln',
     'lat': 51.51992634,
     'lng': -0.10945263,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51992634,
       'lng': -0.10945263}],
     'distance': 1886,
     'postalCode': 'EC1N 7TE',
     'cc': 'GB',
     'neighborhood': 'Holborn and Covent Garden, London, Greater London',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['23-25 Leather Ln',
      'London',
      'Greater London',
      'EC1N 7TE',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683948',
    'hasPerk': False}]}}

Get relevant part of JSON and transform it into a pandas dataframe

In [113]:
# assign relevant part of JSON to venues
venues = results['response']['venues']

# tranform venues into a dataframe
dataframe = json_normalize(venues)
dataframe
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:5: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
  """
Out[113]:
id name categories referralId hasPerk location.address location.crossStreet location.lat location.lng location.labeledLatLngs location.distance location.postalCode location.cc location.city location.state location.country location.formattedAddress location.neighborhood venuePage.id
0 4b4b47f5f964a520609626e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False The Grand Building Trafalgar Square 52 -0 [{'label': 'display', 'lat': 51.50764442847237... 53 WC2N 5EJ GB London Greater London United Kingdom [The Grand Building (Trafalgar Square), London... NaN NaN
1 4cda944022bd721e533df047 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 15 Regent St Jermyn St 52 -0 [{'label': 'display', 'lat': 51.50879033505443... 462 SW1Y 4LR GB London Greater London United Kingdom [15 Regent St (Jermyn St), London, Greater Lon... NaN NaN
2 4ae815e0f964a52014ae21e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 17 Embankment Pl NaN 52 -0 [{'label': 'display', 'lat': 51.50730858076348... 336 WC2N 6NN GB London Greater London United Kingdom [17 Embankment Pl, London, Greater London, WC2... Embankmen NaN
3 4b24fad1f964a520f66a24e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 13 New Row NaN 52 -0 [{'label': 'display', 'lat': 51.51115239980299... 447 WC2N 4LF GB London Greater London United Kingdom [13 New Row, London, Greater London, WC2N 4LF,... NaN NaN
4 4c7f554fd51ea143cc5e5a9f Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 9-11 Kingsway NaN 52 -0 [{'label': 'display', 'lat': 51.51359089480928... 973 WC2B 6UN GB London Greater London United Kingdom [9-11 Kingsway, London, Greater London, WC2B 6... NaN NaN
5 4b6fc85bf964a52069fc2ce3 AMT Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False St. Thomas Hospital Lambeth Palace Road 51 -0 [{'label': 'display', 'lat': 51.49997320903263... 1015 SE1 7EH GB London Greater London United Kingdom [St. Thomas Hospital (Lambeth Palace Road), Lo... NaN NaN
6 596e24c212c8f014009d6842 Soho Coffee company [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 65 Kingsway NaN 52 -0 [{'label': 'display', 'lat': 51.51537503662551... 1075 WC2B 6TD GB London Greater London United Kingdom [65 Kingsway, London, Greater London, WC2B 6TD... Holborn and Covent Garden NaN
7 4b2630f7f964a5200a7924e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 200 Piccadilly NaN 52 -0 [{'label': 'display', 'lat': 51.50896578159291... 645 W1J 9HU GB London Greater London United Kingdom [200 Piccadilly, London, Greater London, W1J 9... NaN NaN
8 4aeebda6f964a52038d421e3 Algerian Coffee Stores [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 52 Old Compton St NaN 52 -0 [{'label': 'display', 'lat': 51.51286473760223... 689 W1D 4PB GB London Greater London United Kingdom [52 Old Compton St, London, Greater London, W1... NaN NaN
9 4d7b8859645ea35daeb133f8 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 39 Shelton St NaN 52 -0 [{'label': 'display', 'lat': 51.51407186153086... 777 WC2H 9HJ GB Covent Garden Greater London United Kingdom [39 Shelton St, Covent Garden, Greater London,... NaN NaN
10 4cac1b4d36fa6dcb80e6db78 Despatch Box Coffee Shop [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False Portcullis House NaN 52 -0 [{'label': 'display', 'lat': 51.50111406437572... 719 SW1 A 2 GB London Greater London United Kingdom [Portcullis House, London, Greater London, SW1... NaN NaN
11 551a93a2498ed90a2cc7e544 Department of Coffee and Social Affairs [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 15 Sherwood St Regent St Quadrant 52 -0 [{'label': 'display', 'lat': 51.51087965006803... 694 W1F 7ED GB Soho Greater London United Kingdom [15 Sherwood St (Regent St Quadrant), Soho, Gr... Piccadilly, London, Greater London NaN
12 4b7d4467f964a52082b52fe3 Double Shot Coffee Co. [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 38 Tavistock St NaN 52 -0 NaN 757 WC2E 7PB GB London Greater London United Kingdom [38 Tavistock St, London, Greater London, WC2E... NaN NaN
13 4b817ecef964a52033aa30e3 AMT Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 16 Neal Street NaN 52 -0 [{'label': 'display', 'lat': 51.51370664977727... 737 NaN GB London Greater London United Kingdom [16 Neal Street, London, Greater London, Unite... NaN NaN
14 4ac518edf964a520c1ac20e3 Monmouth Coffee Company [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 27 Monmouth St NaN 52 -0 [{'label': 'display', 'lat': 51.514314, 'lng':... 780 WC2H 9EU GB Covent Garden Greater London United Kingdom [27 Monmouth St, Covent Garden, Greater London... Holborn and Covent Garden NaN
15 5a6dfdcf48b04e70ed5493b5 Hej Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False Strand NaN 52 -0 [{'label': 'display', 'lat': 51.511265, 'lng':... 828 W C2R GB London Greater London United Kingdom [Strand, London, Greater London, W C2R, United... NaN NaN
16 553e368d498ecddb31302a1c Crosstown Doughnuts & Coffee [{'id': '4bf58dd8d48988d148941735', 'name': 'D... v-1590683948 False 4 Broadwick St NaN 52 -0 [{'label': 'display', 'lat': 51.51404256630057... 889 W1F 8HJ GB London Greater London United Kingdom [4 Broadwick St, London, Greater London, W1F 8... Soho, London, Greater London 127184114
17 5565c24d498e2885d1b9a54e Coffee Geek and Friends [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False Unit 22 Cardinal Place 6 Cathedral Walk 51 -0 [{'label': 'display', 'lat': 51.49763776601168... 1444 SW1E 5JH GB London Greater London United Kingdom [Unit 22 Cardinal Place (6 Cathedral Walk), Lo... NaN NaN
18 56d44205cd10603392e9101e Press Coffee & Co. [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 81 Chancery Ln NaN 52 -0 [{'label': 'display', 'lat': 51.515798, 'lng':... 1439 WC2A 1DD GB London Greater London United Kingdom [81 Chancery Ln, London, Greater London, WC2A ... NaN NaN
19 5242cbc411d25ddcbaf84656 The Somerset Coffee Bar [{'id': '4bf58dd8d48988d1a1941735', 'name': 'C... v-1590683948 False Strand Campus NaN 52 -0 [{'label': 'display', 'lat': 51.51137166465521... 913 WC2R 2LS GB London Greater London United Kingdom [Strand Campus, London, Greater London, WC2R 2... NaN NaN
20 574ee1f9498ebb08c52ff8cb Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 76-78 Upper Ground NaN 52 -0 [{'label': 'display', 'lat': 51.50776564909346... 993 SE1 9PZ GB London Greater London United Kingdom [76-78 Upper Ground, London, Greater London, S... NaN NaN
21 50b282aae4b0dabb590f2fbe Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 1 Charlie Chaplin Walk at Waterloo Rd 52 -0 [{'label': 'display', 'lat': 51.50476681331239... 1018 SE1 1XR GB Waterloo Greater London United Kingdom [1 Charlie Chaplin Walk (at Waterloo Rd), Wate... NaN NaN
22 4c5e9aaf9b28d13a44c35c70 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 3 Cardinal Walk Victoria St 51 -0 [{'label': 'display', 'lat': 51.49707313663782... 1485 SW1E 5JE GB Victoria Greater London United Kingdom [3 Cardinal Walk (Victoria St), Victoria, Grea... NaN NaN
23 4ad204d6f964a520dfde20e3 The Old Coffee House [{'id': '4bf58dd8d48988d11b941735', 'name': 'P... v-1590683948 False 49 Beak St NaN 52 -0 [{'label': 'display', 'lat': 51.51262085770566... 894 W1F 9SF GB Soho Greater London United Kingdom [49 Beak St, Soho, Greater London, W1F 9SF, Un... NaN NaN
24 58e50bd73ef0f646864352dd Better Coffee Corner [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False Oasis Sports Centre, 32 Endell St NaN 52 -0 [{'label': 'display', 'lat': 51.515705, 'lng':... 940 WC2H 9AG GB London Greater London United Kingdom [Oasis Sports Centre, 32 Endell St, London, Gr... NaN NaN
25 4cc2c86b8062468853762b2f Soho Coffee Club [{'id': '4bf58dd8d48988d16d941735', 'name': 'C... v-1590683948 False Dean St NaN 52 -0 [{'label': 'display', 'lat': 51.51527327636101... 978 NaN GB Soho Greater London United Kingdom [Dean St, Soho, Greater London, United Kingdom] NaN NaN
26 5883913551d19e062a758a77 Ralph's Coffee & Bar [{'id': '4bf58dd8d48988d16d941735', 'name': 'C... v-1590683948 False 173 Regent Street NaN 52 -0 [{'label': 'display', 'lat': 51.51214764828749... 1023 W1B 4JQ GB London Greater London United Kingdom [173 Regent Street, London, Greater London, W1... NaN NaN
27 4f7ac16fe4b0e4c448e2a05b Notes Coffee Barrows [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 60 St Giles High St NaN 52 -0 [{'label': 'display', 'lat': 51.51553615403286... 917 WC2H 8LG GB Greater London Greater London United Kingdom [60 St Giles High St, Greater London, WC2H 8LG... NaN NaN
28 5221d93b11d2750f339082be Sharps Coffee Bar [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 9 Windmill St NaN 52 -0 [{'label': 'display', 'lat': 51.51880890491309... 1352 W1T 2JF GB Fitzrovia Greater London United Kingdom [9 Windmill St, Fitzrovia, Greater London, W1T... NaN NaN
29 5082d072e4b09e409c582ab4 TAP Coffee No. 193 [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 193 Wardour St btwn Oxford St & Noel St 52 -0 [{'label': 'display', 'lat': 51.51550905, 'lng... 1071 W1F 8ZF GB Soho Greater London United Kingdom [193 Wardour St (btwn Oxford St & Noel St), So... NaN NaN
30 4b9bc455f964a520da2236e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False London Waterloo Station (WAT) Opposite Platform 11 52 -0 [{'label': 'display', 'lat': 51.50318004562804... 1137 SE1 8SW GB London Greater London United Kingdom [London Waterloo Station (WAT) (Opposite Platf... NaN NaN
31 4b25316df964a520b96d24e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 11 Argyll St NaN 52 -0 [{'label': 'display', 'lat': 51.51475276642239... 1236 W1F 7TX GB London Greater London United Kingdom [11 Argyll St, London, Greater London, W1F 7TX... NaN NaN
32 4c3d6ed94bc9a5939b07d471 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 4 Great Portland St NaN 52 -0 [{'label': 'display', 'lat': 51.51573111967288... 1300 W1W 8QJ GB London Greater London United Kingdom [4 Great Portland St, London, Greater London, ... NaN NaN
33 4b0c6aa1f964a520cd3c23e3 Flat Cap Coffee Co [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 4 Strutton Ground at Old Pye St 51 -0 [{'label': 'display', 'lat': 51.49749647419568... 1175 SW1P 2HR GB London Greater London United Kingdom [4 Strutton Ground (at Old Pye St), London, Gr... NaN NaN
34 4b5201d2f964a520d96027e3 Coffee Republic [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 2 South Molton St NaN 52 -0 [{'label': 'display', 'lat': 51.51460380934164... 1564 W1K 5QA GB London Greater London United Kingdom [2 South Molton St, London, Greater London, W1... NaN NaN
35 4ba0a226f964a520237537e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 226 High Holborn at Kingsway 52 -0 [{'label': 'display', 'lat': 51.517563, 'lng':... 1253 WC1V 7DZ GB London Greater London United Kingdom [226 High Holborn (at Kingsway), London, Great... NaN NaN
36 4e143ca37d8b4c0d630c715b Department of Coffee and Social Affairs [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 114 Tottenham Ct Rd at Midford Pl 52 -0 [{'label': 'display', 'lat': 51.52339592535782... 1902 W1T 5AH GB Bloomsbury Greater London United Kingdom [114 Tottenham Ct Rd (at Midford Pl), Bloomsbu... NaN NaN
37 53384902498e0f1c0982f993 Coffee on Ground [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False Debenhams 334-348 Oxford St 52 -0 [{'label': 'display', 'lat': 51.515263, 'lng':... 1696 NaN GB London Greater London United Kingdom [Debenhams (334-348 Oxford St), London, Greate... NaN NaN
38 5ab688ff037be12b6480737e Rachel's Nails & Coffee [{'id': '4f04aa0c2fb6e1c99f3db0b8', 'name': 'N... v-1590683948 False 34 Windmill Street NaN 52 -0 [{'label': 'display', 'lat': 51.518882, 'lng':... 1358 W1T 2JR GB London Greater London United Kingdom [34 Windmill Street, London, Greater London, W... NaN 543697886
39 4ad9a8acf964a5205f1a21e3 Monmouth Coffee Company [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 2 Park St The Borough 52 -0 [{'label': 'display', 'lat': 51.505536, 'lng':... 2513 SE1 9AB GB London Greater London United Kingdom [2 Park St (The Borough), London, Greater Lond... NaN NaN
40 4e9fe923b634b81226148799 International Coffee Organization [{'id': '4bf58dd8d48988d124941735', 'name': 'O... v-1590683948 False 22 Berners St NaN 52 -0 [{'label': 'display', 'lat': 51.51778967616555... 1327 W1T 3DD GB London Greater London United Kingdom [22 Berners St, London, Greater London, W1T 3D... NaN 80040026
41 4d09d8ce33d6b60ce15f9785 Coffee Republic [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 99 Tottenham Court Rd NaN 52 -0 [{'label': 'display', 'lat': 51.52228710523008... 1762 W1T 4TS GB Fitzrovia Greater London United Kingdom [99 Tottenham Court Rd, Fitzrovia, Greater Lon... NaN NaN
42 4d749547d0c737046217f217 Igor's Coffee [{'id': '4bf58dd8d48988d1cb941735', 'name': 'F... v-1590683948 False Old St NaN 52 -0 [{'label': 'display', 'lat': 51.50826928107465... 1134 NaN GB Shoreditch Greater London United Kingdom [Old St, Shoreditch, Greater London, United Ki... Shoreditch, London, Greater London NaN
43 4e7c4d38183853fb9f712dcb 2 Love Tea And Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False Lambeth Palace Rd NaN 51 -0 [{'label': 'display', 'lat': 51.49608859432227... 1336 SE1 GB London Greater London United Kingdom [Lambeth Palace Rd, London, Greater London, S... NaN NaN
44 4e8ac70a8b810d8892781ae2 Notes Coffee Barrows [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 186a Fleet St NaN 52 -0 [{'label': 'display', 'lat': 51.51409489806739... 1438 EC4A 2HR GB London Greater London United Kingdom [186a Fleet St, London, Greater London, EC4A 2... NaN NaN
45 4b9fae0bf964a5203e3437e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 311-318 High Holborn NaN 52 -0 [{'label': 'display', 'lat': 51.51828657519206... 1585 WC1V 7BB GB Greater London Greater London United Kingdom [311-318 High Holborn, Greater London, WC1V 7B... NaN NaN
46 4cfa6667ee9cb60c44fd89ad Department of Coffee and Social Affairs [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 14-16 Leather Ln NaN 52 -0 [{'label': 'display', 'lat': 51.51931845391665... 1849 EC1N 7SU GB London Greater London United Kingdom [14-16 Leather Ln, London, Greater London, EC1... NaN NaN
47 4c99dc8ba004a1cd8dee426e Coffee, Cake & Kink HQ [{'id': '4bf58dd8d48988d124941735', 'name': 'O... v-1590683948 False 38 Mount Pleasant NaN 52 -0 [{'label': 'display', 'lat': 51.52234330631439... 1964 WC1X 0AN GB Camden Town Greater London United Kingdom [38 Mount Pleasant, Camden Town, Greater Londo... NaN NaN
48 4bc9c597b6c49c74bce88e91 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 82 Gower St in Waterstones 52 -0 [{'label': 'display', 'lat': 51.52223061484879... 1691 WC1E 6EQ GB Camden Town Greater London United Kingdom [82 Gower St (in Waterstones), Camden Town, Gr... NaN NaN
49 4d5d33e3fb186dcb4030099b Prufrock Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683948 False 23-25 Leather Ln NaN 52 -0 [{'label': 'display', 'lat': 51.51992634, 'lng... 1886 EC1N 7TE GB London Greater London United Kingdom [23-25 Leather Ln, London, Greater London, EC1... Holborn and Covent Garden, London, Greater London NaN

Define information of interest and filter dataframe

In [114]:
# keep only columns that include venue name, and anything that is associated with location
filtered_columns = ['name', 'categories'] + [col for col in dataframe.columns if col.startswith('location.')] + ['id']
dataframe_filtered = dataframe.loc[:, filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
dataframe_filtered['categories'] = dataframe_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
dataframe_filtered.columns = [column.split('.')[-1] for column in dataframe_filtered.columns]

dataframe_filtered
Out[114]:
name categories address crossStreet lat lng labeledLatLngs distance postalCode cc city state country formattedAddress neighborhood id
0 Costa Coffee Coffee Shop The Grand Building Trafalgar Square 52 -0 [{'label': 'display', 'lat': 51.50764442847237... 53 WC2N 5EJ GB London Greater London United Kingdom [The Grand Building (Trafalgar Square), London... NaN 4b4b47f5f964a520609626e3
1 Costa Coffee Coffee Shop 15 Regent St Jermyn St 52 -0 [{'label': 'display', 'lat': 51.50879033505443... 462 SW1Y 4LR GB London Greater London United Kingdom [15 Regent St (Jermyn St), London, Greater Lon... NaN 4cda944022bd721e533df047
2 Costa Coffee Coffee Shop 17 Embankment Pl NaN 52 -0 [{'label': 'display', 'lat': 51.50730858076348... 336 WC2N 6NN GB London Greater London United Kingdom [17 Embankment Pl, London, Greater London, WC2... Embankmen 4ae815e0f964a52014ae21e3
3 Costa Coffee Coffee Shop 13 New Row NaN 52 -0 [{'label': 'display', 'lat': 51.51115239980299... 447 WC2N 4LF GB London Greater London United Kingdom [13 New Row, London, Greater London, WC2N 4LF,... NaN 4b24fad1f964a520f66a24e3
4 Costa Coffee Coffee Shop 9-11 Kingsway NaN 52 -0 [{'label': 'display', 'lat': 51.51359089480928... 973 WC2B 6UN GB London Greater London United Kingdom [9-11 Kingsway, London, Greater London, WC2B 6... NaN 4c7f554fd51ea143cc5e5a9f
5 AMT Coffee Coffee Shop St. Thomas Hospital Lambeth Palace Road 51 -0 [{'label': 'display', 'lat': 51.49997320903263... 1015 SE1 7EH GB London Greater London United Kingdom [St. Thomas Hospital (Lambeth Palace Road), Lo... NaN 4b6fc85bf964a52069fc2ce3
6 Soho Coffee company Coffee Shop 65 Kingsway NaN 52 -0 [{'label': 'display', 'lat': 51.51537503662551... 1075 WC2B 6TD GB London Greater London United Kingdom [65 Kingsway, London, Greater London, WC2B 6TD... Holborn and Covent Garden 596e24c212c8f014009d6842
7 Costa Coffee Coffee Shop 200 Piccadilly NaN 52 -0 [{'label': 'display', 'lat': 51.50896578159291... 645 W1J 9HU GB London Greater London United Kingdom [200 Piccadilly, London, Greater London, W1J 9... NaN 4b2630f7f964a5200a7924e3
8 Algerian Coffee Stores Coffee Shop 52 Old Compton St NaN 52 -0 [{'label': 'display', 'lat': 51.51286473760223... 689 W1D 4PB GB London Greater London United Kingdom [52 Old Compton St, London, Greater London, W1... NaN 4aeebda6f964a52038d421e3
9 Costa Coffee Coffee Shop 39 Shelton St NaN 52 -0 [{'label': 'display', 'lat': 51.51407186153086... 777 WC2H 9HJ GB Covent Garden Greater London United Kingdom [39 Shelton St, Covent Garden, Greater London,... NaN 4d7b8859645ea35daeb133f8
10 Despatch Box Coffee Shop Coffee Shop Portcullis House NaN 52 -0 [{'label': 'display', 'lat': 51.50111406437572... 719 SW1 A 2 GB London Greater London United Kingdom [Portcullis House, London, Greater London, SW1... NaN 4cac1b4d36fa6dcb80e6db78
11 Department of Coffee and Social Affairs Coffee Shop 15 Sherwood St Regent St Quadrant 52 -0 [{'label': 'display', 'lat': 51.51087965006803... 694 W1F 7ED GB Soho Greater London United Kingdom [15 Sherwood St (Regent St Quadrant), Soho, Gr... Piccadilly, London, Greater London 551a93a2498ed90a2cc7e544
12 Double Shot Coffee Co. Coffee Shop 38 Tavistock St NaN 52 -0 NaN 757 WC2E 7PB GB London Greater London United Kingdom [38 Tavistock St, London, Greater London, WC2E... NaN 4b7d4467f964a52082b52fe3
13 AMT Coffee Coffee Shop 16 Neal Street NaN 52 -0 [{'label': 'display', 'lat': 51.51370664977727... 737 NaN GB London Greater London United Kingdom [16 Neal Street, London, Greater London, Unite... NaN 4b817ecef964a52033aa30e3
14 Monmouth Coffee Company Coffee Shop 27 Monmouth St NaN 52 -0 [{'label': 'display', 'lat': 51.514314, 'lng':... 780 WC2H 9EU GB Covent Garden Greater London United Kingdom [27 Monmouth St, Covent Garden, Greater London... Holborn and Covent Garden 4ac518edf964a520c1ac20e3
15 Hej Coffee Coffee Shop Strand NaN 52 -0 [{'label': 'display', 'lat': 51.511265, 'lng':... 828 W C2R GB London Greater London United Kingdom [Strand, London, Greater London, W C2R, United... NaN 5a6dfdcf48b04e70ed5493b5
16 Crosstown Doughnuts & Coffee Donut Shop 4 Broadwick St NaN 52 -0 [{'label': 'display', 'lat': 51.51404256630057... 889 W1F 8HJ GB London Greater London United Kingdom [4 Broadwick St, London, Greater London, W1F 8... Soho, London, Greater London 553e368d498ecddb31302a1c
17 Coffee Geek and Friends Coffee Shop Unit 22 Cardinal Place 6 Cathedral Walk 51 -0 [{'label': 'display', 'lat': 51.49763776601168... 1444 SW1E 5JH GB London Greater London United Kingdom [Unit 22 Cardinal Place (6 Cathedral Walk), Lo... NaN 5565c24d498e2885d1b9a54e
18 Press Coffee & Co. Coffee Shop 81 Chancery Ln NaN 52 -0 [{'label': 'display', 'lat': 51.515798, 'lng':... 1439 WC2A 1DD GB London Greater London United Kingdom [81 Chancery Ln, London, Greater London, WC2A ... NaN 56d44205cd10603392e9101e
19 The Somerset Coffee Bar College Cafeteria Strand Campus NaN 52 -0 [{'label': 'display', 'lat': 51.51137166465521... 913 WC2R 2LS GB London Greater London United Kingdom [Strand Campus, London, Greater London, WC2R 2... NaN 5242cbc411d25ddcbaf84656
20 Costa Coffee Coffee Shop 76-78 Upper Ground NaN 52 -0 [{'label': 'display', 'lat': 51.50776564909346... 993 SE1 9PZ GB London Greater London United Kingdom [76-78 Upper Ground, London, Greater London, S... NaN 574ee1f9498ebb08c52ff8cb
21 Costa Coffee Coffee Shop 1 Charlie Chaplin Walk at Waterloo Rd 52 -0 [{'label': 'display', 'lat': 51.50476681331239... 1018 SE1 1XR GB Waterloo Greater London United Kingdom [1 Charlie Chaplin Walk (at Waterloo Rd), Wate... NaN 50b282aae4b0dabb590f2fbe
22 Costa Coffee Coffee Shop 3 Cardinal Walk Victoria St 51 -0 [{'label': 'display', 'lat': 51.49707313663782... 1485 SW1E 5JE GB Victoria Greater London United Kingdom [3 Cardinal Walk (Victoria St), Victoria, Grea... NaN 4c5e9aaf9b28d13a44c35c70
23 The Old Coffee House Pub 49 Beak St NaN 52 -0 [{'label': 'display', 'lat': 51.51262085770566... 894 W1F 9SF GB Soho Greater London United Kingdom [49 Beak St, Soho, Greater London, W1F 9SF, Un... NaN 4ad204d6f964a520dfde20e3
24 Better Coffee Corner Coffee Shop Oasis Sports Centre, 32 Endell St NaN 52 -0 [{'label': 'display', 'lat': 51.515705, 'lng':... 940 WC2H 9AG GB London Greater London United Kingdom [Oasis Sports Centre, 32 Endell St, London, Gr... NaN 58e50bd73ef0f646864352dd
25 Soho Coffee Club Café Dean St NaN 52 -0 [{'label': 'display', 'lat': 51.51527327636101... 978 NaN GB Soho Greater London United Kingdom [Dean St, Soho, Greater London, United Kingdom] NaN 4cc2c86b8062468853762b2f
26 Ralph's Coffee & Bar Café 173 Regent Street NaN 52 -0 [{'label': 'display', 'lat': 51.51214764828749... 1023 W1B 4JQ GB London Greater London United Kingdom [173 Regent Street, London, Greater London, W1... NaN 5883913551d19e062a758a77
27 Notes Coffee Barrows Coffee Shop 60 St Giles High St NaN 52 -0 [{'label': 'display', 'lat': 51.51553615403286... 917 WC2H 8LG GB Greater London Greater London United Kingdom [60 St Giles High St, Greater London, WC2H 8LG... NaN 4f7ac16fe4b0e4c448e2a05b
28 Sharps Coffee Bar Coffee Shop 9 Windmill St NaN 52 -0 [{'label': 'display', 'lat': 51.51880890491309... 1352 W1T 2JF GB Fitzrovia Greater London United Kingdom [9 Windmill St, Fitzrovia, Greater London, W1T... NaN 5221d93b11d2750f339082be
29 TAP Coffee No. 193 Coffee Shop 193 Wardour St btwn Oxford St & Noel St 52 -0 [{'label': 'display', 'lat': 51.51550905, 'lng... 1071 W1F 8ZF GB Soho Greater London United Kingdom [193 Wardour St (btwn Oxford St & Noel St), So... NaN 5082d072e4b09e409c582ab4
30 Costa Coffee Coffee Shop London Waterloo Station (WAT) Opposite Platform 11 52 -0 [{'label': 'display', 'lat': 51.50318004562804... 1137 SE1 8SW GB London Greater London United Kingdom [London Waterloo Station (WAT) (Opposite Platf... NaN 4b9bc455f964a520da2236e3
31 Costa Coffee Coffee Shop 11 Argyll St NaN 52 -0 [{'label': 'display', 'lat': 51.51475276642239... 1236 W1F 7TX GB London Greater London United Kingdom [11 Argyll St, London, Greater London, W1F 7TX... NaN 4b25316df964a520b96d24e3
32 Costa Coffee Coffee Shop 4 Great Portland St NaN 52 -0 [{'label': 'display', 'lat': 51.51573111967288... 1300 W1W 8QJ GB London Greater London United Kingdom [4 Great Portland St, London, Greater London, ... NaN 4c3d6ed94bc9a5939b07d471
33 Flat Cap Coffee Co Coffee Shop 4 Strutton Ground at Old Pye St 51 -0 [{'label': 'display', 'lat': 51.49749647419568... 1175 SW1P 2HR GB London Greater London United Kingdom [4 Strutton Ground (at Old Pye St), London, Gr... NaN 4b0c6aa1f964a520cd3c23e3
34 Coffee Republic Coffee Shop 2 South Molton St NaN 52 -0 [{'label': 'display', 'lat': 51.51460380934164... 1564 W1K 5QA GB London Greater London United Kingdom [2 South Molton St, London, Greater London, W1... NaN 4b5201d2f964a520d96027e3
35 Costa Coffee Coffee Shop 226 High Holborn at Kingsway 52 -0 [{'label': 'display', 'lat': 51.517563, 'lng':... 1253 WC1V 7DZ GB London Greater London United Kingdom [226 High Holborn (at Kingsway), London, Great... NaN 4ba0a226f964a520237537e3
36 Department of Coffee and Social Affairs Coffee Shop 114 Tottenham Ct Rd at Midford Pl 52 -0 [{'label': 'display', 'lat': 51.52339592535782... 1902 W1T 5AH GB Bloomsbury Greater London United Kingdom [114 Tottenham Ct Rd (at Midford Pl), Bloomsbu... NaN 4e143ca37d8b4c0d630c715b
37 Coffee on Ground Coffee Shop Debenhams 334-348 Oxford St 52 -0 [{'label': 'display', 'lat': 51.515263, 'lng':... 1696 NaN GB London Greater London United Kingdom [Debenhams (334-348 Oxford St), London, Greate... NaN 53384902498e0f1c0982f993
38 Rachel's Nails & Coffee Nail Salon 34 Windmill Street NaN 52 -0 [{'label': 'display', 'lat': 51.518882, 'lng':... 1358 W1T 2JR GB London Greater London United Kingdom [34 Windmill Street, London, Greater London, W... NaN 5ab688ff037be12b6480737e
39 Monmouth Coffee Company Coffee Shop 2 Park St The Borough 52 -0 [{'label': 'display', 'lat': 51.505536, 'lng':... 2513 SE1 9AB GB London Greater London United Kingdom [2 Park St (The Borough), London, Greater Lond... NaN 4ad9a8acf964a5205f1a21e3
40 International Coffee Organization Office 22 Berners St NaN 52 -0 [{'label': 'display', 'lat': 51.51778967616555... 1327 W1T 3DD GB London Greater London United Kingdom [22 Berners St, London, Greater London, W1T 3D... NaN 4e9fe923b634b81226148799
41 Coffee Republic Coffee Shop 99 Tottenham Court Rd NaN 52 -0 [{'label': 'display', 'lat': 51.52228710523008... 1762 W1T 4TS GB Fitzrovia Greater London United Kingdom [99 Tottenham Court Rd, Fitzrovia, Greater Lon... NaN 4d09d8ce33d6b60ce15f9785
42 Igor's Coffee Food Truck Old St NaN 52 -0 [{'label': 'display', 'lat': 51.50826928107465... 1134 NaN GB Shoreditch Greater London United Kingdom [Old St, Shoreditch, Greater London, United Ki... Shoreditch, London, Greater London 4d749547d0c737046217f217
43 2 Love Tea And Coffee Coffee Shop Lambeth Palace Rd NaN 51 -0 [{'label': 'display', 'lat': 51.49608859432227... 1336 SE1 GB London Greater London United Kingdom [Lambeth Palace Rd, London, Greater London, S... NaN 4e7c4d38183853fb9f712dcb
44 Notes Coffee Barrows Coffee Shop 186a Fleet St NaN 52 -0 [{'label': 'display', 'lat': 51.51409489806739... 1438 EC4A 2HR GB London Greater London United Kingdom [186a Fleet St, London, Greater London, EC4A 2... NaN 4e8ac70a8b810d8892781ae2
45 Costa Coffee Coffee Shop 311-318 High Holborn NaN 52 -0 [{'label': 'display', 'lat': 51.51828657519206... 1585 WC1V 7BB GB Greater London Greater London United Kingdom [311-318 High Holborn, Greater London, WC1V 7B... NaN 4b9fae0bf964a5203e3437e3
46 Department of Coffee and Social Affairs Coffee Shop 14-16 Leather Ln NaN 52 -0 [{'label': 'display', 'lat': 51.51931845391665... 1849 EC1N 7SU GB London Greater London United Kingdom [14-16 Leather Ln, London, Greater London, EC1... NaN 4cfa6667ee9cb60c44fd89ad
47 Coffee, Cake & Kink HQ Office 38 Mount Pleasant NaN 52 -0 [{'label': 'display', 'lat': 51.52234330631439... 1964 WC1X 0AN GB Camden Town Greater London United Kingdom [38 Mount Pleasant, Camden Town, Greater Londo... NaN 4c99dc8ba004a1cd8dee426e
48 Costa Coffee Coffee Shop 82 Gower St in Waterstones 52 -0 [{'label': 'display', 'lat': 51.52223061484879... 1691 WC1E 6EQ GB Camden Town Greater London United Kingdom [82 Gower St (in Waterstones), Camden Town, Gr... NaN 4bc9c597b6c49c74bce88e91
49 Prufrock Coffee Coffee Shop 23-25 Leather Ln NaN 52 -0 [{'label': 'display', 'lat': 51.51992634, 'lng... 1886 EC1N 7TE GB London Greater London United Kingdom [23-25 Leather Ln, London, Greater London, EC1... Holborn and Covent Garden, London, Greater London 4d5d33e3fb186dcb4030099b

Let's visualize the Coffee Shops that are nearby

In [115]:
dataframe_filtered.name
Out[115]:
0                                Costa Coffee
1                                Costa Coffee
2                                Costa Coffee
3                                Costa Coffee
4                                Costa Coffee
5                                  AMT Coffee
6                         Soho Coffee company
7                                Costa Coffee
8                      Algerian Coffee Stores
9                                Costa Coffee
10                   Despatch Box Coffee Shop
11    Department of Coffee and Social Affairs
12                     Double Shot Coffee Co.
13                                 AMT Coffee
14                    Monmouth Coffee Company
15                                 Hej Coffee
16               Crosstown Doughnuts & Coffee
17                    Coffee Geek and Friends
18                         Press Coffee & Co.
19                    The Somerset Coffee Bar
20                               Costa Coffee
21                               Costa Coffee
22                               Costa Coffee
23                       The Old Coffee House
24                       Better Coffee Corner
25                           Soho Coffee Club
26                       Ralph's Coffee & Bar
27                       Notes Coffee Barrows
28                          Sharps Coffee Bar
29                         TAP Coffee No. 193
30                               Costa Coffee
31                               Costa Coffee
32                               Costa Coffee
33                         Flat Cap Coffee Co
34                            Coffee Republic
35                               Costa Coffee
36    Department of Coffee and Social Affairs
37                           Coffee on Ground
38                    Rachel's Nails & Coffee
39                    Monmouth Coffee Company
40          International Coffee Organization
41                            Coffee Republic
42                              Igor's Coffee
43                      2 Love Tea And Coffee
44                       Notes Coffee Barrows
45                               Costa Coffee
46    Department of Coffee and Social Affairs
47                     Coffee, Cake & Kink HQ
48                               Costa Coffee
49                            Prufrock Coffee
Name: name, dtype: object
In [116]:
# How many coffee shops are there in close vicinity of the City of London
dataframe_filtered.shape
Out[116]:
(50, 16)
In [117]:
# generate map centred around the City of London Boroug
ldn_map = folium.Map(location=[latitude, longitude], zoom_start=13)

# add a red circle marker to represent the City of London Borough
folium.features.CircleMarker(
    [latitude, longitude],
    radius=10,
    color='red',
    popup='City of London',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(ldn_map)

# add the Coffee Shops as green circle markers
for Latitude, Longitude, name in zip(dataframe_filtered.lat, dataframe_filtered.lng, dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='blue',
        popup=label,
        fill = True,
        fill_color='blue',
        fill_opacity=0.3
    ).add_to(ldn_map)
    

# display map
ldn_map 
Out[117]:

Get Foursquare data for the different high population density London borough

Islington

In [118]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)

# Create a Borough geolocator (replace all the borough names within the code for different borough information)
address = 'Islington, London, UK'
geolocator = Nominatim(user_agent="foursquare_agent")
ilocation = geolocator.geocode(address)
ilatitude = ilocation.latitude
ilongitude = ilocation.longitude
print(latitude, longitude)

# Create a search query for coffee shops within a xxm radius of the Borough centre
search_query = 'Costa Coffee'
radius = 5000
limit = 500
print(search_query + ' .... OK!')

iurl = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, ilatitude, ilongitude, VERSION, search_query, radius, limit)
iurl

islington_results = requests.get(iurl).json()
islington_results

# assign relevant part of JSON to venues
islington_venues = islington_results['response']['venues']

# tranform venues into a dataframe
islington_dataframe = json_normalize(islington_venues)

# keep only columns that include venue name, and anything that is associated with location
filtered_columns = ['name', 'categories'] + [col for col in islington_dataframe.columns if col.startswith('location.')] + ['id']
islington_dataframe_filtered = islington_dataframe.loc[:, filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
islington_dataframe_filtered['categories'] = islington_dataframe_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
islington_dataframe_filtered.columns = [column.split('.')[-1] for column in islington_dataframe_filtered.columns]

# generate map centred around the City of London Borough
islington_map = folium.Map(location=[ilatitude, ilongitude], zoom_start=13)

# add a red circle marker to represent the London Borough  
folium.features.CircleMarker(
        [ilatitude, ilongitude],
        radius=10,
        color='red',
        popup='Islington',
        fill = True,
        fill_color = 'red',
        fill_opacity = 0.6
    ).add_to(islington_map)

# add the Islington Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(islington_dataframe_filtered.lat, islington_dataframe_filtered.lng, islington_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(islington_map)
    
# display map
islington_map
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
51.5073219 -0.1276474
Costa Coffee .... OK!
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:33: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
Out[118]:

Tower Hamlets

In [119]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)

# Create a Borough geolocator (replace all the borough names within the code for different borough information)
address = 'Tower Hamlets, London, UK'
geolocator = Nominatim(user_agent="foursquare_agent")
tlocation = geolocator.geocode(address)
tlatitude = tlocation.latitude
tlongitude = tlocation.longitude
print(tlatitude, tlongitude)

# Create a search query for coffee shops within a xxm radius of the Borough centre
search_query = 'Costa Coffee'
radius = 5000
limit = 500
print(search_query + ' .... OK!')

turl = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, tlatitude, tlongitude, VERSION, search_query, radius, limit)
turl

tower_results = requests.get(turl).json()

# assign relevant part of JSON to venues
tower_venues = tower_results['response']['venues']

# tranform venues into a dataframe
tower_dataframe = json_normalize(tower_venues)

# keep only columns that include venue name, and anything that is associated with location
tower_filtered_columns = ['name', 'categories'] + [col for col in tower_dataframe.columns if col.startswith('location.')] + ['id']
tower_dataframe_filtered = tower_dataframe.loc[:, tower_filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
tower_dataframe_filtered['categories'] = tower_dataframe_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
tower_dataframe_filtered.columns = [column.split('.')[-1] for column in tower_dataframe_filtered.columns]
tower_dataframe_filtered.columns

# generate map centred around the chosen London Borough
tower_map = folium.Map(location=[tlatitude, tlongitude], zoom_start=13)

# add a red circle marker to represent the London Borough  
folium.features.CircleMarker(
        [tlatitude, tlongitude],
        radius=10,
        color='red',
        popup='Tower hamlets',
        fill = True,
        fill_color = 'red',
        fill_opacity = 0.6
    ).add_to(tower_map)

# add the Tower Hamlets Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(tower_dataframe_filtered.lat, tower_dataframe_filtered.lng, tower_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(tower_map)
    

# display map
tower_map
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
51.5256294 -0.0335853
Costa Coffee .... OK!
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:32: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
Out[119]:

Hackney

In [120]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)

# Create a Borough geolocator (replace all the borough names within the code for different borough information)
address = 'Hackney, London, UK'
geolocator = Nominatim(user_agent="foursquare_agent")
hlocation = geolocator.geocode(address)
hlatitude = hlocation.latitude
hlongitude = hlocation.longitude
print(hlatitude, hlongitude)

# Create a search query for coffee shops within a xxm radius of the Borough centre
search_query = 'Costa Coffee'
radius = 5000
limit = 500
print(search_query + ' .... OK!')

hurl = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, hlatitude, hlongitude, VERSION, search_query, radius, limit)
hurl

hackney_results = requests.get(hurl).json()

# assign relevant part of JSON to venues
hackney_venues = hackney_results['response']['venues']

# tranform venues into a dataframe
hackney_dataframe = json_normalize(hackney_venues)

# keep only columns that include venue name, and anything that is associated with location
hackney_filtered_columns = ['name', 'categories'] + [col for col in hackney_dataframe.columns if col.startswith('location.')] + ['id']
hackney_dataframe_filtered = hackney_dataframe.loc[:, hackney_filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
hackney_dataframe_filtered['categories'] = hackney_dataframe_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
hackney_dataframe_filtered.columns = [column.split('.')[-1] for column in hackney_dataframe_filtered.columns]
hackney_dataframe_filtered.columns

# generate map centred around the chosen London Borough
hackney_map = folium.Map(location=[hlatitude, hlongitude], zoom_start=13)

# add a red circle marker to represent the London Borough  
folium.features.CircleMarker(
        [hlatitude, hlongitude],
        radius=10,
        color='red',
        popup='Hackney',
        fill = True,
        fill_color = 'red',
        fill_opacity = 0.6
    ).add_to(hackney_map)

# add the Tower Hamlets Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(hackney_dataframe_filtered.lat, hackney_dataframe_filtered.lng, hackney_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(hackney_map)
    

# display map
hackney_map
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
51.5432402 -0.0493621
Costa Coffee .... OK!
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:32: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
Out[120]:

Kensington & Chelsea

In [121]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)

# Create a Borough geolocator (replace all the borough names within the code for different borough information)
address = 'Kensington, London, UK'
geolocator = Nominatim(user_agent="foursquare_agent")
klocation = geolocator.geocode(address)
klatitude = klocation.latitude
klongitude = klocation.longitude
print(klatitude, klongitude)

# Create a search query for coffee shops within a xxm radius of the Borough centre
search_query = 'Costa Coffee'
radius = 5000
limit = 500
print(search_query + ' .... OK!')

kurl = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, klatitude, klongitude, VERSION, search_query, radius, limit)
kurl

ken_results = requests.get(kurl).json()

# assign relevant part of JSON to venues
ken_venues = ken_results['response']['venues']

# tranform venues into a dataframe
ken_dataframe = json_normalize(ken_venues)

# keep only columns that include venue name, and anything that is associated with location
ken_filtered_columns = ['name', 'categories'] + [col for col in ken_dataframe.columns if col.startswith('location.')] + ['id']
ken_dataframe_filtered = ken_dataframe.loc[:, ken_filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
ken_dataframe_filtered['categories'] = ken_dataframe_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
ken_dataframe_filtered.columns = [column.split('.')[-1] for column in ken_dataframe_filtered.columns]
ken_dataframe_filtered.columns

# generate map centred around the chosen London Borough
ken_map = folium.Map(location=[klatitude, klongitude], zoom_start=13)

# add a red circle marker to represent the London Borough  
folium.features.CircleMarker(
        [klatitude, klongitude],
        radius=10,
        color='red',
        popup='Hackney',
        fill = True,
        fill_color = 'red',
        fill_opacity = 0.6
    ).add_to(ken_map)

# add the Kensington & Chelsea Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(ken_dataframe_filtered.lat, ken_dataframe_filtered.lng, ken_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(ken_map)
    
# display map
ken_map
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
51.4989948 -0.1991229
Costa Coffee .... OK!
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:32: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
Out[121]:

Lambeth

In [122]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)

# Create a Borough geolocator (replace all the borough names within the code for different borough information)
address = 'Lambeth, London, UK'
geolocator = Nominatim(user_agent="foursquare_agent")
llocation = geolocator.geocode(address)
llatitude = llocation.latitude
llongitude = llocation.longitude
print(llatitude, llongitude)

# Create a search query for coffee shops within a xxm radius of the Borough centre
search_query = 'Costa Coffee'
radius = 5000
limit = 500
print(search_query + ' .... OK!')

lurl = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, llatitude, llongitude, VERSION, search_query, radius, limit)
lurl

l_results = requests.get(lurl).json()

# assign relevant part of JSON to venues
l_venues = l_results['response']['venues']

# tranform venues into a dataframe
l_dataframe = json_normalize(l_venues)

# keep only columns that include venue name, and anything that is associated with location
l_filtered_columns = ['name', 'categories'] + [col for col in l_dataframe.columns if col.startswith('location.')] + ['id']
l_dataframe_filtered = l_dataframe.loc[:, l_filtered_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
l_dataframe_filtered['categories'] = l_dataframe_filtered.apply(get_category_type, axis=1)

# clean column names by keeping only last term
l_dataframe_filtered.columns = [column.split('.')[-1] for column in l_dataframe_filtered.columns]
l_dataframe_filtered.columns

# generate map centred around the chosen London Borough
l_map = folium.Map(location=[llatitude, llongitude], zoom_start=13)

# add a red circle marker to represent the London Borough  
folium.features.CircleMarker(
        [llatitude, llongitude],
        radius=10,
        color='red',
        popup='Lambeth',
        fill = True,
        fill_color = 'red',
        fill_opacity = 0.6
    ).add_to(l_map)

# add the Lambeth Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(l_dataframe_filtered.lat, l_dataframe_filtered.lng, l_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(l_map)
    
# display map
l_map
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
51.5013012 -0.117287
Costa Coffee .... OK!
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:32: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
Out[122]:

Get Starbucks branded coffee store locations

Starbucks
In [123]:
# Establish a df from the global Starbucks location csv file 
dfs = pd.read_csv('/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./London directory.csv')
dfs.head(10)
Out[123]:
Brand Ownership Type Street Address City Country Postcode Longitude Latitude
0 Starbucks Company Owned 37-39 St. John's Road, Brixton Underground Sta... London GB SW11 1QN -0 51
1 Starbucks Company Owned Shop 5, Brixton Underground Station London GB SW9 -0 51
2 Starbucks Franchise A120 Thermal Lane, London Stansted Airport London GB CM24 1PY 0 52
3 Starbucks Company Owned St. Paul's Church Yard, Juxon House, Unit 2, R... London GB EC4M 8EH -0 52
4 Starbucks Company Owned 296 Pentoville Road, Regents Corner, London - ... London GB N1 9NR -0 52
5 Starbucks Company Owned 186 Earls Court Road London GB SW5 9QG -0 51
6 Starbucks Company Owned 227 Portobello Road London GB W11 1LT -0 52
7 Starbucks Company Owned 159 Great Portland Street, Canary Wharf - Jubilee London GB W1N 5FD -0 52
8 Starbucks Company Owned Unit R:P:490, One Canada Square London GB E14 5AB -0 52
9 Starbucks Company Owned 41 - 43 Bedford Hill, Balham London GB SW12 9EY -0 51
In [124]:
dfs.shape
Out[124]:
(198, 8)
In [125]:
dfs.dtypes
Out[125]:
Brand              object
Ownership Type     object
Street Address     object
City               object
Country            object
Postcode           object
Longitude         float64
Latitude          float64
dtype: object
In [126]:
# generate map centred around the City of London Borough
starbucks_map = folium.Map(location=[latitude, longitude], zoom_start=13)

# add a red circle marker to represent the City of London Borough
folium.features.CircleMarker(
    [latitude, longitude],
    radius=10,
    color='red',
    popup='City of London',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(starbucks_map)

# add the Starbucks Coffee Shops as green circle markers
for Latitude, Longitude, label in zip(dfs.Latitude, dfs.Longitude, dfs.Brand):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='green',
        popup=label,
        fill = True,
        fill_color='green',
        fill_opacity=0.3
    ).add_to(starbucks_map)
    

# display map
starbucks_map
Out[126]:
In [ ]:
 

Get Costa coffee shop information

In [127]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
In [128]:
# Create a search query for coffee shops within a xxm radius of the london centre
costa_query = 'Costa Coffee'
radius = 5000
LIMIT = 1500
print(costa_query + ' .... OK!')
Costa Coffee .... OK!
In [129]:
c_url = 'https://api.foursquare.com/v2/venues/search?client_id={}&client_secret={}&ll={},{}&v={}&query={}&radius={}&limit={}'.format(CLIENT_ID, CLIENT_SECRET, latitude, longitude, VERSION, costa_query, radius, LIMIT)
c_url
Out[129]:
'https://api.foursquare.com/v2/venues/search?client_id=ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD&client_secret=1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ&ll=51.5073219,-0.1276474&v=20180604&query=Costa Coffee&radius=5000&limit=1500'
In [130]:
c_results = requests.get(c_url).json()
c_results
Out[130]:
{'meta': {'code': 200, 'requestId': '5ecfe8f714a126001b559574'},
 'response': {'venues': [{'id': '4b4b47f5f964a520609626e3',
    'name': 'Costa Coffee',
    'location': {'address': 'The Grand Building',
     'crossStreet': 'Trafalgar Square',
     'lat': 51.507644428472375,
     'lng': -0.1270757830083151,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.507644428472375,
       'lng': -0.1270757830083151}],
     'distance': 53,
     'postalCode': 'WC2N 5EJ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['The Grand Building (Trafalgar Square)',
      'London',
      'Greater London',
      'WC2N 5EJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4cda944022bd721e533df047',
    'name': 'Costa Coffee',
    'location': {'address': '15 Regent St',
     'crossStreet': 'Jermyn St',
     'lat': 51.50879033505443,
     'lng': -0.13388720503979742,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50879033505443,
       'lng': -0.13388720503979742}],
     'distance': 462,
     'postalCode': 'SW1Y 4LR',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['15 Regent St (Jermyn St)',
      'London',
      'Greater London',
      'SW1Y 4LR',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4ae815e0f964a52014ae21e3',
    'name': 'Costa Coffee',
    'location': {'address': '17 Embankment Pl',
     'lat': 51.50730858076348,
     'lng': -0.12279268681923348,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50730858076348,
       'lng': -0.12279268681923348}],
     'distance': 336,
     'postalCode': 'WC2N 6NN',
     'cc': 'GB',
     'neighborhood': 'Embankmen',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['17 Embankment Pl',
      'London',
      'Greater London',
      'WC2N 6NN',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4b24fad1f964a520f66a24e3',
    'name': 'Costa Coffee',
    'location': {'address': '13 New Row',
     'lat': 51.51115239980299,
     'lng': -0.1256779215913941,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51115239980299,
       'lng': -0.1256779215913941}],
     'distance': 447,
     'postalCode': 'WC2N 4LF',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['13 New Row',
      'London',
      'Greater London',
      'WC2N 4LF',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4c7f554fd51ea143cc5e5a9f',
    'name': 'Costa Coffee',
    'location': {'address': '9-11 Kingsway',
     'lat': 51.51359089480928,
     'lng': -0.1178481570622197,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51359089480928,
       'lng': -0.1178481570622197}],
     'distance': 973,
     'postalCode': 'WC2B 6UN',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['9-11 Kingsway',
      'London',
      'Greater London',
      'WC2B 6UN',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4b2630f7f964a5200a7924e3',
    'name': 'Costa Coffee',
    'location': {'address': '200 Piccadilly',
     'lat': 51.50896578159291,
     'lng': -0.13658616852203312,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50896578159291,
       'lng': -0.13658616852203312}],
     'distance': 645,
     'postalCode': 'W1J 9HU',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['200 Piccadilly',
      'London',
      'Greater London',
      'W1J 9HU',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4d7b8859645ea35daeb133f8',
    'name': 'Costa Coffee',
    'location': {'address': '39 Shelton St',
     'lat': 51.514071861530866,
     'lng': -0.12476381471489859,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.514071861530866,
       'lng': -0.12476381471489859}],
     'distance': 777,
     'postalCode': 'WC2H 9HJ',
     'cc': 'GB',
     'city': 'Covent Garden',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['39 Shelton St',
      'Covent Garden',
      'Greater London',
      'WC2H 9HJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '574ee1f9498ebb08c52ff8cb',
    'name': 'Costa Coffee',
    'location': {'address': '76-78 Upper Ground',
     'lat': 51.507765649093464,
     'lng': -0.11332702409990071,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.507765649093464,
       'lng': -0.11332702409990071}],
     'distance': 993,
     'postalCode': 'SE1 9PZ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['76-78 Upper Ground',
      'London',
      'Greater London',
      'SE1 9PZ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4c5e9aaf9b28d13a44c35c70',
    'name': 'Costa Coffee',
    'location': {'address': '3 Cardinal Walk',
     'crossStreet': 'Victoria St',
     'lat': 51.49707313663782,
     'lng': -0.1413876188745272,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49707313663782,
       'lng': -0.1413876188745272}],
     'distance': 1485,
     'postalCode': 'SW1E 5JE',
     'cc': 'GB',
     'city': 'Victoria',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['3 Cardinal Walk (Victoria St)',
      'Victoria',
      'Greater London',
      'SW1E 5JE',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '50b282aae4b0dabb590f2fbe',
    'name': 'Costa Coffee',
    'location': {'address': '1 Charlie Chaplin Walk',
     'crossStreet': 'at Waterloo Rd',
     'lat': 51.50476681331239,
     'lng': -0.11352908168467384,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50476681331239,
       'lng': -0.11352908168467384}],
     'distance': 1018,
     'postalCode': 'SE1 1XR',
     'cc': 'GB',
     'city': 'Waterloo',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['1 Charlie Chaplin Walk (at Waterloo Rd)',
      'Waterloo',
      'Greater London',
      'SE1 1XR',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '5c068c5a3af988002ca0ea12',
    'name': 'Costa Coffee',
    'location': {'address': 'Unit 8, Charing Cross Station',
     'lat': 51.50809293333605,
     'lng': -0.12508471924028058,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50809293333605,
       'lng': -0.12508471924028058}],
     'distance': 197,
     'postalCode': 'WC2N 5HS',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Unit 8, Charing Cross Station',
      'London',
      'Greater London',
      'WC2N 5HS',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4b25316df964a520b96d24e3',
    'name': 'Costa Coffee',
    'location': {'address': '11 Argyll St',
     'lat': 51.51475276642239,
     'lng': -0.14090585711763323,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51475276642239,
       'lng': -0.14090585711763323}],
     'distance': 1236,
     'postalCode': 'W1F 7TX',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['11 Argyll St',
      'London',
      'Greater London',
      'W1F 7TX',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4ba0a226f964a520237537e3',
    'name': 'Costa Coffee',
    'location': {'address': '226 High Holborn',
     'crossStreet': 'at Kingsway',
     'lat': 51.517563,
     'lng': -0.120121725,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.517563,
       'lng': -0.120121725}],
     'distance': 1253,
     'postalCode': 'WC1V 7DZ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['226 High Holborn (at Kingsway)',
      'London',
      'Greater London',
      'WC1V 7DZ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4c3d6ed94bc9a5939b07d471',
    'name': 'Costa Coffee',
    'location': {'address': '4 Great Portland St',
     'lat': 51.51573111967288,
     'lng': -0.14068655684295295,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51573111967288,
       'lng': -0.14068655684295295}],
     'distance': 1300,
     'postalCode': 'W1W 8QJ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['4 Great Portland St',
      'London',
      'Greater London',
      'W1W 8QJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4b9bc455f964a520da2236e3',
    'name': 'Costa Coffee',
    'location': {'address': 'London Waterloo Station (WAT)',
     'crossStreet': 'Opposite Platform 11',
     'lat': 51.50318004562804,
     'lng': -0.11264348734111061,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50318004562804,
       'lng': -0.11264348734111061}],
     'distance': 1137,
     'postalCode': 'SE1 8SW',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['London Waterloo Station (WAT) (Opposite Platform 11)',
      'London',
      'Greater London',
      'SE1 8SW',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '510a30c5e4b063dd75d6c657',
    'name': 'Costa Coffee',
    'location': {'address': '22-24 Leicester Sq',
     'lat': 51.510263217015556,
     'lng': -0.12977750816746,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.510263217015556,
       'lng': -0.12977750816746}],
     'distance': 359,
     'postalCode': 'W C2H',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['22-24 Leicester Sq',
      'London',
      'Greater London',
      'W C2H',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '541ad923498e462813a4bb41',
    'name': 'Costa Coffee',
    'location': {'address': '34 Broadway',
     'lat': 51.49958506166648,
     'lng': -0.13306377581699905,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49958506166648,
       'lng': -0.13306377581699905}],
     'distance': 939,
     'postalCode': 'SW1H 0BH',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['34 Broadway',
      'London',
      'Greater London',
      'SW1H 0BH',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4b9fae0bf964a5203e3437e3',
    'name': 'Costa Coffee',
    'location': {'address': '311-318 High Holborn',
     'lat': 51.51828657519206,
     'lng': -0.11303394786584942,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51828657519206,
       'lng': -0.11303394786584942}],
     'distance': 1585,
     'postalCode': 'WC1V 7BB',
     'cc': 'GB',
     'city': 'Greater London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['311-318 High Holborn',
      'Greater London',
      'WC1V 7BB',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4bc9c597b6c49c74bce88e91',
    'name': 'Costa Coffee',
    'location': {'address': '82 Gower St',
     'crossStreet': 'in Waterstones',
     'lat': 51.522230614848795,
     'lng': -0.13233472532684573,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.522230614848795,
       'lng': -0.13233472532684573}],
     'distance': 1691,
     'postalCode': 'WC1E 6EQ',
     'cc': 'GB',
     'city': 'Camden Town',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['82 Gower St (in Waterstones)',
      'Camden Town',
      'Greater London',
      'WC1E 6EQ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4dc019804b2221ec2d68c817',
    'name': 'Costa Coffee',
    'location': {'address': 'Bryanston St',
     'crossStreet': 'Amba Hotel',
     'lat': 51.51429609294906,
     'lng': -0.15624377278737528,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51429609294906,
       'lng': -0.15624377278737528}],
     'distance': 2127,
     'postalCode': 'W1H 7EH',
     'cc': 'GB',
     'city': 'Marble Arch',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Bryanston St (Amba Hotel)',
      'Marble Arch',
      'Greater London',
      'W1H 7EH',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4ad21f70f964a52082df20e3',
    'name': 'Costa Coffee',
    'location': {'address': '108 Edgware Rd',
     'lat': 51.515862679553,
     'lng': -0.1640260941748267,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.515862679553,
       'lng': -0.1640260941748267}],
     'distance': 2693,
     'postalCode': 'W2 2EZ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['108 Edgware Rd',
      'London',
      'Greater London',
      'W2 2EZ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '516062c4498efb317371df9b',
    'name': 'Costa Coffee',
    'location': {'lat': 51.516228,
     'lng': -0.134052,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.516228,
       'lng': -0.134052}],
     'distance': 1086,
     'cc': 'GB',
     'country': 'United Kingdom',
     'formattedAddress': ['United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4b8f70f8f964a5209a5433e3',
    'name': 'Costa Coffee',
    'location': {'address': '13 New Bridge St',
     'crossStreet': 'Bridewell Place',
     'lat': 51.51307450150601,
     'lng': -0.1042515760569992,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51307450150601,
       'lng': -0.1042515760569992}],
     'distance': 1742,
     'postalCode': 'EC4V 6AU',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['13 New Bridge St (Bridewell Place)',
      'London',
      'Greater London',
      'EC4V 6AU',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4f2f85d2e4b0d411bd310162',
    'name': 'Costa Coffee',
    'location': {'address': 'London Victoria Station (VIC)',
     'crossStreet': 'Victoria Island',
     'lat': 51.49509318221339,
     'lng': -0.1438165039936379,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49509318221339,
       'lng': -0.1438165039936379}],
     'distance': 1763,
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['London Victoria Station (VIC) (Victoria Island)',
      'London',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '556eeb46498e31edba2efda2',
    'name': 'Costa Coffee',
    'location': {'address': '1 Curzon St',
     'lat': 51.50783,
     'lng': -0.145181,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50783,
       'lng': -0.145181}],
     'distance': 1216,
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['1 Curzon St',
      'London',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4fb60120e4b0a5e32711bb58',
    'name': 'Costa Coffee',
    'location': {'address': 'One Great George St',
     'lat': 51.50121966342386,
     'lng': -0.12910850170243543,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50121966342386,
       'lng': -0.12910850170243543}],
     'distance': 686,
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['One Great George St',
      'London',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4bacfe8df964a52059223be3',
    'name': 'Costa Coffee',
    'location': {'address': '1st Floor, Victoria Place Shopping Centre',
     'crossStreet': 'Victoria Station',
     'lat': 51.49443003475631,
     'lng': -0.14526511968114056,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49443003475631,
       'lng': -0.14526511968114056}],
     'distance': 1884,
     'postalCode': 'SW1  E5',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['1st Floor, Victoria Place Shopping Centre (Victoria Station)',
      'London',
      'Greater London',
      'SW1  E5',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4f05ad04e3002adb767756c2',
    'name': 'Costa Coffee',
    'location': {'address': '125 Tooley St',
     'lat': 51.50423659998283,
     'lng': -0.08174614724029487,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50423659998283,
       'lng': -0.08174614724029487}],
     'distance': 3198,
     'postalCode': 'SE1 2RS',
     'cc': 'GB',
     'city': 'Bermondsey',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['125 Tooley St',
      'Bermondsey',
      'Greater London',
      'SE1 2RS',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '5aafffc87918713b5d1dfa36',
    'name': 'Costa Coffee',
    'location': {'address': 'Westminster Tube Station',
     'lat': 51.50093364186963,
     'lng': -0.12480467457557845,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.50093364186963,
       'lng': -0.12480467457557845}],
     'distance': 737,
     'postalCode': 'S W1A',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Westminster Tube Station',
      'London',
      'Greater London',
      'S W1A',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4ad2de98f964a520c3e220e3',
    'name': 'Costa Coffee',
    'location': {'address': '55 Marchmont St.',
     'lat': 51.52504088534715,
     'lng': -0.1253041873608421,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52504088534715,
       'lng': -0.1253041873608421}],
     'distance': 1979,
     'postalCode': 'WC1N 1AP',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['55 Marchmont St.',
      'London',
      'Greater London',
      'WC1N 1AP',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '54353063498e39dba772481d',
    'name': 'Costa Coffee',
    'location': {'address': '38 Eastcastle St',
     'lat': 51.51640895885459,
     'lng': -0.13919471967695687,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51640895885459,
       'lng': -0.13919471967695687}],
     'distance': 1289,
     'postalCode': 'W1W 8DS',
     'cc': 'GB',
     'country': 'United Kingdom',
     'formattedAddress': ['38 Eastcastle St', 'W1W 8DS', 'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4bdd6da8645e0f477f766b19',
    'name': 'Costa Coffee',
    'location': {'address': 'Ludgate Hill',
     'lat': 51.513898296474885,
     'lng': -0.10107132252061228,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.513898296474885,
       'lng': -0.10107132252061228}],
     'distance': 1981,
     'postalCode': 'EC4M 7JH',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Ludgate Hill',
      'London',
      'Greater London',
      'EC4M 7JH',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '50a27654e4b04e11e8194388',
    'name': 'Costa Coffee',
    'location': {'address': 'Excel',
     'lat': 51.51915744331586,
     'lng': -0.12112789178137769,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51915744331586,
       'lng': -0.12112789178137769}],
     'distance': 1392,
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Excel',
      'London',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4cd1568901eaf04d3ca4bd5d',
    'name': 'Costa Coffee',
    'location': {'address': '111 Guildford St',
     'crossStreet': 'Grays Inn Rd',
     'lat': 51.52442966351805,
     'lng': -0.11601556382357163,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52442966351805,
       'lng': -0.11601556382357163}],
     'distance': 2067,
     'postalCode': 'WC1N 1DP',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['111 Guildford St (Grays Inn Rd)',
      'London',
      'Greater London',
      'WC1N 1DP',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '56ff918f498e2210eaa6791c',
    'name': 'Costa Coffee',
    'location': {'address': 'Horseferry Road',
     'lat': 51.49490697641138,
     'lng': -0.12947528766284455,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.49490697641138,
       'lng': -0.12947528766284455}],
     'distance': 1387,
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['Horseferry Road',
      'London',
      'Greater London',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4af2ed8cf964a52040e921e3',
    'name': 'Costa Coffee',
    'location': {'address': '46 Cowcross St',
     'lat': 51.519985045783095,
     'lng': -0.1049964042259406,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.519985045783095,
       'lng': -0.1049964042259406}],
     'distance': 2109,
     'postalCode': 'EC1M 6BY',
     'cc': 'GB',
     'city': 'Farringdon',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['46 Cowcross St',
      'Farringdon',
      'Greater London',
      'EC1M 6BY',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4c15e3c7a9c220a138cd599d',
    'name': 'Costa Coffee',
    'location': {'address': '112 Southampton Row',
     'lat': 51.52043807973682,
     'lng': -0.12283221996636895,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52043807973682,
       'lng': -0.12283221996636895}],
     'distance': 1497,
     'postalCode': 'WC1B 4BL',
     'cc': 'GB',
     'city': 'Camden Town',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['112 Southampton Row',
      'Camden Town',
      'Greater London',
      'WC1B 4BL',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4c971d3703413704a6ed89ef',
    'name': 'Costa Coffee',
    'location': {'address': '138 Cheapside',
     'lat': 51.51471263124064,
     'lng': -0.0967051174700917,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51471263124064,
       'lng': -0.0967051174700917}],
     'distance': 2296,
     'postalCode': 'EC2V 6LB',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['138 Cheapside',
      'London',
      'Greater London',
      'EC2V 6LB',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4b7d4e3ef964a5205cb72fe3',
    'name': 'Costa Coffee',
    'location': {'address': 'Euston Rd',
     'crossStreet': "Duke's Rd",
     'lat': 51.52779291855632,
     'lng': -0.12946075876266386,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52779291855632,
       'lng': -0.12946075876266386}],
     'distance': 2282,
     'postalCode': 'WC1H 9PJ',
     'cc': 'GB',
     'city': 'Euston',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ["Euston Rd (Duke's Rd)",
      'Euston',
      'Greater London',
      'WC1H 9PJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '560a3f6a498e33ae67fdf084',
    'name': 'Costa Coffee',
    'location': {'address': '104 New Oxford St',
     'lat': 51.51663447291778,
     'lng': -0.12869703528692442,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51663447291778,
       'lng': -0.12869703528692442}],
     'distance': 1039,
     'postalCode': 'WC1A 1HB',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['104 New Oxford St',
      'London',
      'Greater London',
      'WC1A 1HB',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4ba888dcf964a520efde39e3',
    'name': 'Costa Coffee',
    'location': {'address': '9 Bow Lane',
     'lat': 51.513018220780005,
     'lng': -0.09360636225691218,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.513018220780005,
       'lng': -0.09360636225691218}],
     'distance': 2442,
     'postalCode': 'EC4M 9BJ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['9 Bow Lane',
      'London',
      'Greater London',
      'EC4M 9BJ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4c0ba4996071a5936c7fe132',
    'name': 'Costa Coffee',
    'location': {'address': 'London Euston Station (EUS)',
     'crossStreet': 'Unit 4, Platform 11',
     'lat': 51.52851148211822,
     'lng': -0.1340829705384466,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52851148211822,
       'lng': -0.1340829705384466}],
     'distance': 2400,
     'postalCode': 'NW1 2RT',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['London Euston Station (EUS) (Unit 4, Platform 11)',
      'London',
      'Greater London',
      'NW1 2RT',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '51b4ad7b498e4c703c64fa2c',
    'name': 'Costa Coffee',
    'location': {'lat': 51.52246781903864,
     'lng': -0.13006234005654402,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52246781903864,
       'lng': -0.13006234005654402}],
     'distance': 1694,
     'cc': 'GB',
     'country': 'United Kingdom',
     'formattedAddress': ['United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4df88bd488778675b548c1e3',
    'name': 'Costa Coffee',
    'location': {'address': 'University Of Westminster',
     'crossStreet': '35 Marylebone Rd',
     'lat': 51.5222435557099,
     'lng': -0.15509464443430304,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.5222435557099,
       'lng': -0.15509464443430304}],
     'distance': 2524,
     'postalCode': 'NW1 5LS',
     'cc': 'GB',
     'city': 'Paddington',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['University Of Westminster (35 Marylebone Rd)',
      'Paddington',
      'Greater London',
      'NW1 5LS',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4bda7e4b3904a5932da5469e',
    'name': 'Costa Coffee',
    'location': {'address': '3 Millbrook Pl.',
     'lat': 51.534531,
     'lng': -0.138975,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.534531,
       'lng': -0.138975}],
     'distance': 3128,
     'postalCode': 'NW1 2JA',
     'cc': 'GB',
     'city': 'Camden Town',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['3 Millbrook Pl.',
      'Camden Town',
      'Greater London',
      'NW1 2JA',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4df895052271607ac9184065',
    'name': 'Costa Coffee',
    'location': {'address': '35 Marylebone Rd',
     'lat': 51.52259303415855,
     'lng': -0.15507586496731704,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.52259303415855,
       'lng': -0.15507586496731704}],
     'distance': 2549,
     'postalCode': 'NW1 5LS',
     'cc': 'GB',
     'city': 'Greater London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['35 Marylebone Rd',
      'Greater London',
      'NW1 5LS',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '5050c6a6e4b0706cbc520a7f',
    'name': 'Costa Coffee',
    'location': {'address': '14 Great Marlborough St',
     'crossStreet': 'Ramillies St',
     'lat': 51.51459009305343,
     'lng': -0.1387954252580835,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.51459009305343,
       'lng': -0.1387954252580835}],
     'distance': 1118,
     'postalCode': 'W1F 7HP',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['14 Great Marlborough St (Ramillies St)',
      'London',
      'Greater London',
      'W1F 7HP',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '4bc4ac9f74a9a593d029d6f6',
    'name': 'Costa Coffee',
    'location': {'address': "Unit 3, King's Cross St. Pancras Underground Station",
     'crossStreet': 'Euston Road',
     'lat': 51.53002975905134,
     'lng': -0.12429901481892897,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.53002975905134,
       'lng': -0.12429901481892897}],
     'distance': 2538,
     'postalCode': 'N1 9AL',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ["Unit 3, King's Cross St. Pancras Underground Station (Euston Road)",
      'Camden',
      'Greater London',
      'N1 9AL',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '5bddb0084a7aae00395885d5',
    'name': 'Costa Coffee',
    'location': {'address': '123 Oxford St',
     'lat': 51.515875,
     'lng': -0.136386,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.515875,
       'lng': -0.136386}],
     'distance': 1128,
     'postalCode': 'W1D 1LT',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['123 Oxford St',
      'London',
      'Greater London',
      'W1D 1LT',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False},
   {'id': '534f9552498e4de1f2d9655c',
    'name': 'Costa Coffee',
    'location': {'address': '3 Southwark St',
     'lat': 51.504662537377655,
     'lng': -0.09088023064683254,
     'labeledLatLngs': [{'label': 'display',
       'lat': 51.504662537377655,
       'lng': -0.09088023064683254}],
     'distance': 2564,
     'postalCode': 'SE1 1RQ',
     'cc': 'GB',
     'city': 'London',
     'state': 'Greater London',
     'country': 'United Kingdom',
     'formattedAddress': ['3 Southwark St',
      'London',
      'Greater London',
      'SE1 1RQ',
      'United Kingdom']},
    'categories': [{'id': '4bf58dd8d48988d1e0931735',
      'name': 'Coffee Shop',
      'pluralName': 'Coffee Shops',
      'shortName': 'Coffee Shop',
      'icon': {'prefix': 'https://ss3.4sqi.net/img/categories_v2/food/coffeeshop_',
       'suffix': '.png'},
      'primary': True}],
    'referralId': 'v-1590683983',
    'hasPerk': False}]}}
In [131]:
# assign relevant part of JSON to venues
c_venues = c_results['response']['venues']

# tranform venues into a dataframe
c_dataframe = json_normalize(c_venues)
c_dataframe
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:5: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
  """
Out[131]:
id name categories referralId hasPerk location.address location.crossStreet location.lat location.lng location.labeledLatLngs location.distance location.postalCode location.cc location.city location.state location.country location.formattedAddress location.neighborhood
0 4b4b47f5f964a520609626e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False The Grand Building Trafalgar Square 52 -0 [{'label': 'display', 'lat': 51.50764442847237... 53 WC2N 5EJ GB London Greater London United Kingdom [The Grand Building (Trafalgar Square), London... NaN
1 4cda944022bd721e533df047 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 15 Regent St Jermyn St 52 -0 [{'label': 'display', 'lat': 51.50879033505443... 462 SW1Y 4LR GB London Greater London United Kingdom [15 Regent St (Jermyn St), London, Greater Lon... NaN
2 4ae815e0f964a52014ae21e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 17 Embankment Pl NaN 52 -0 [{'label': 'display', 'lat': 51.50730858076348... 336 WC2N 6NN GB London Greater London United Kingdom [17 Embankment Pl, London, Greater London, WC2... Embankmen
3 4b24fad1f964a520f66a24e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 13 New Row NaN 52 -0 [{'label': 'display', 'lat': 51.51115239980299... 447 WC2N 4LF GB London Greater London United Kingdom [13 New Row, London, Greater London, WC2N 4LF,... NaN
4 4c7f554fd51ea143cc5e5a9f Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 9-11 Kingsway NaN 52 -0 [{'label': 'display', 'lat': 51.51359089480928... 973 WC2B 6UN GB London Greater London United Kingdom [9-11 Kingsway, London, Greater London, WC2B 6... NaN
5 4b2630f7f964a5200a7924e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 200 Piccadilly NaN 52 -0 [{'label': 'display', 'lat': 51.50896578159291... 645 W1J 9HU GB London Greater London United Kingdom [200 Piccadilly, London, Greater London, W1J 9... NaN
6 4d7b8859645ea35daeb133f8 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 39 Shelton St NaN 52 -0 [{'label': 'display', 'lat': 51.51407186153086... 777 WC2H 9HJ GB Covent Garden Greater London United Kingdom [39 Shelton St, Covent Garden, Greater London,... NaN
7 574ee1f9498ebb08c52ff8cb Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 76-78 Upper Ground NaN 52 -0 [{'label': 'display', 'lat': 51.50776564909346... 993 SE1 9PZ GB London Greater London United Kingdom [76-78 Upper Ground, London, Greater London, S... NaN
8 4c5e9aaf9b28d13a44c35c70 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 3 Cardinal Walk Victoria St 51 -0 [{'label': 'display', 'lat': 51.49707313663782... 1485 SW1E 5JE GB Victoria Greater London United Kingdom [3 Cardinal Walk (Victoria St), Victoria, Grea... NaN
9 50b282aae4b0dabb590f2fbe Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 1 Charlie Chaplin Walk at Waterloo Rd 52 -0 [{'label': 'display', 'lat': 51.50476681331239... 1018 SE1 1XR GB Waterloo Greater London United Kingdom [1 Charlie Chaplin Walk (at Waterloo Rd), Wate... NaN
10 5c068c5a3af988002ca0ea12 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Unit 8, Charing Cross Station NaN 52 -0 [{'label': 'display', 'lat': 51.50809293333605... 197 WC2N 5HS GB London Greater London United Kingdom [Unit 8, Charing Cross Station, London, Greate... NaN
11 4b25316df964a520b96d24e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 11 Argyll St NaN 52 -0 [{'label': 'display', 'lat': 51.51475276642239... 1236 W1F 7TX GB London Greater London United Kingdom [11 Argyll St, London, Greater London, W1F 7TX... NaN
12 4ba0a226f964a520237537e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 226 High Holborn at Kingsway 52 -0 [{'label': 'display', 'lat': 51.517563, 'lng':... 1253 WC1V 7DZ GB London Greater London United Kingdom [226 High Holborn (at Kingsway), London, Great... NaN
13 4c3d6ed94bc9a5939b07d471 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 4 Great Portland St NaN 52 -0 [{'label': 'display', 'lat': 51.51573111967288... 1300 W1W 8QJ GB London Greater London United Kingdom [4 Great Portland St, London, Greater London, ... NaN
14 4b9bc455f964a520da2236e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False London Waterloo Station (WAT) Opposite Platform 11 52 -0 [{'label': 'display', 'lat': 51.50318004562804... 1137 SE1 8SW GB London Greater London United Kingdom [London Waterloo Station (WAT) (Opposite Platf... NaN
15 510a30c5e4b063dd75d6c657 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 22-24 Leicester Sq NaN 52 -0 [{'label': 'display', 'lat': 51.51026321701555... 359 W C2H GB London Greater London United Kingdom [22-24 Leicester Sq, London, Greater London, W... NaN
16 541ad923498e462813a4bb41 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 34 Broadway NaN 51 -0 [{'label': 'display', 'lat': 51.49958506166648... 939 SW1H 0BH GB London Greater London United Kingdom [34 Broadway, London, Greater London, SW1H 0BH... NaN
17 4b9fae0bf964a5203e3437e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 311-318 High Holborn NaN 52 -0 [{'label': 'display', 'lat': 51.51828657519206... 1585 WC1V 7BB GB Greater London Greater London United Kingdom [311-318 High Holborn, Greater London, WC1V 7B... NaN
18 4bc9c597b6c49c74bce88e91 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 82 Gower St in Waterstones 52 -0 [{'label': 'display', 'lat': 51.52223061484879... 1691 WC1E 6EQ GB Camden Town Greater London United Kingdom [82 Gower St (in Waterstones), Camden Town, Gr... NaN
19 4dc019804b2221ec2d68c817 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Bryanston St Amba Hotel 52 -0 [{'label': 'display', 'lat': 51.51429609294906... 2127 W1H 7EH GB Marble Arch Greater London United Kingdom [Bryanston St (Amba Hotel), Marble Arch, Great... NaN
20 4ad21f70f964a52082df20e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 108 Edgware Rd NaN 52 -0 [{'label': 'display', 'lat': 51.515862679553, ... 2693 W2 2EZ GB London Greater London United Kingdom [108 Edgware Rd, London, Greater London, W2 2E... NaN
21 516062c4498efb317371df9b Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False NaN NaN 52 -0 [{'label': 'display', 'lat': 51.516228, 'lng':... 1086 NaN GB NaN NaN United Kingdom [United Kingdom] NaN
22 4b8f70f8f964a5209a5433e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 13 New Bridge St Bridewell Place 52 -0 [{'label': 'display', 'lat': 51.51307450150601... 1742 EC4V 6AU GB London Greater London United Kingdom [13 New Bridge St (Bridewell Place), London, G... NaN
23 4f2f85d2e4b0d411bd310162 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False London Victoria Station (VIC) Victoria Island 51 -0 [{'label': 'display', 'lat': 51.49509318221339... 1763 NaN GB London Greater London United Kingdom [London Victoria Station (VIC) (Victoria Islan... NaN
24 556eeb46498e31edba2efda2 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 1 Curzon St NaN 52 -0 [{'label': 'display', 'lat': 51.50783, 'lng': ... 1216 NaN GB London Greater London United Kingdom [1 Curzon St, London, Greater London, United K... NaN
25 4fb60120e4b0a5e32711bb58 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False One Great George St NaN 52 -0 [{'label': 'display', 'lat': 51.50121966342386... 686 NaN GB London Greater London United Kingdom [One Great George St, London, Greater London, ... NaN
26 4bacfe8df964a52059223be3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 1st Floor, Victoria Place Shopping Centre Victoria Station 51 -0 [{'label': 'display', 'lat': 51.49443003475631... 1884 SW1 E5 GB London Greater London United Kingdom [1st Floor, Victoria Place Shopping Centre (Vi... NaN
27 4f05ad04e3002adb767756c2 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 125 Tooley St NaN 52 -0 [{'label': 'display', 'lat': 51.50423659998283... 3198 SE1 2RS GB Bermondsey Greater London United Kingdom [125 Tooley St, Bermondsey, Greater London, SE... NaN
28 5aafffc87918713b5d1dfa36 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Westminster Tube Station NaN 52 -0 [{'label': 'display', 'lat': 51.50093364186963... 737 S W1A GB London Greater London United Kingdom [Westminster Tube Station, London, Greater Lon... NaN
29 4ad2de98f964a520c3e220e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 55 Marchmont St. NaN 52 -0 [{'label': 'display', 'lat': 51.52504088534715... 1979 WC1N 1AP GB London Greater London United Kingdom [55 Marchmont St., London, Greater London, WC1... NaN
30 54353063498e39dba772481d Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 38 Eastcastle St NaN 52 -0 [{'label': 'display', 'lat': 51.51640895885459... 1289 W1W 8DS GB NaN NaN United Kingdom [38 Eastcastle St, W1W 8DS, United Kingdom] NaN
31 4bdd6da8645e0f477f766b19 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Ludgate Hill NaN 52 -0 [{'label': 'display', 'lat': 51.51389829647488... 1981 EC4M 7JH GB London Greater London United Kingdom [Ludgate Hill, London, Greater London, EC4M 7J... NaN
32 50a27654e4b04e11e8194388 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Excel NaN 52 -0 [{'label': 'display', 'lat': 51.51915744331586... 1392 NaN GB London Greater London United Kingdom [Excel, London, Greater London, United Kingdom] NaN
33 4cd1568901eaf04d3ca4bd5d Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 111 Guildford St Grays Inn Rd 52 -0 [{'label': 'display', 'lat': 51.52442966351805... 2067 WC1N 1DP GB London Greater London United Kingdom [111 Guildford St (Grays Inn Rd), London, Grea... NaN
34 56ff918f498e2210eaa6791c Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Horseferry Road NaN 51 -0 [{'label': 'display', 'lat': 51.49490697641138... 1387 NaN GB London Greater London United Kingdom [Horseferry Road, London, Greater London, Unit... NaN
35 4af2ed8cf964a52040e921e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 46 Cowcross St NaN 52 -0 [{'label': 'display', 'lat': 51.51998504578309... 2109 EC1M 6BY GB Farringdon Greater London United Kingdom [46 Cowcross St, Farringdon, Greater London, E... NaN
36 4c15e3c7a9c220a138cd599d Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 112 Southampton Row NaN 52 -0 [{'label': 'display', 'lat': 51.52043807973682... 1497 WC1B 4BL GB Camden Town Greater London United Kingdom [112 Southampton Row, Camden Town, Greater Lon... NaN
37 4c971d3703413704a6ed89ef Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 138 Cheapside NaN 52 -0 [{'label': 'display', 'lat': 51.51471263124064... 2296 EC2V 6LB GB London Greater London United Kingdom [138 Cheapside, London, Greater London, EC2V 6... NaN
38 4b7d4e3ef964a5205cb72fe3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Euston Rd Duke's Rd 52 -0 [{'label': 'display', 'lat': 51.52779291855632... 2282 WC1H 9PJ GB Euston Greater London United Kingdom [Euston Rd (Duke's Rd), Euston, Greater London... NaN
39 560a3f6a498e33ae67fdf084 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 104 New Oxford St NaN 52 -0 [{'label': 'display', 'lat': 51.51663447291778... 1039 WC1A 1HB GB London Greater London United Kingdom [104 New Oxford St, London, Greater London, WC... NaN
40 4ba888dcf964a520efde39e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 9 Bow Lane NaN 52 -0 [{'label': 'display', 'lat': 51.51301822078000... 2442 EC4M 9BJ GB London Greater London United Kingdom [9 Bow Lane, London, Greater London, EC4M 9BJ,... NaN
41 4c0ba4996071a5936c7fe132 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False London Euston Station (EUS) Unit 4, Platform 11 52 -0 [{'label': 'display', 'lat': 51.52851148211822... 2400 NW1 2RT GB London Greater London United Kingdom [London Euston Station (EUS) (Unit 4, Platform... NaN
42 51b4ad7b498e4c703c64fa2c Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False NaN NaN 52 -0 [{'label': 'display', 'lat': 51.52246781903864... 1694 NaN GB NaN NaN United Kingdom [United Kingdom] NaN
43 4df88bd488778675b548c1e3 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False University Of Westminster 35 Marylebone Rd 52 -0 [{'label': 'display', 'lat': 51.5222435557099,... 2524 NW1 5LS GB Paddington Greater London United Kingdom [University Of Westminster (35 Marylebone Rd),... NaN
44 4bda7e4b3904a5932da5469e Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 3 Millbrook Pl. NaN 52 -0 [{'label': 'display', 'lat': 51.534531, 'lng':... 3128 NW1 2JA GB Camden Town Greater London United Kingdom [3 Millbrook Pl., Camden Town, Greater London,... NaN
45 4df895052271607ac9184065 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 35 Marylebone Rd NaN 52 -0 [{'label': 'display', 'lat': 51.52259303415855... 2549 NW1 5LS GB Greater London Greater London United Kingdom [35 Marylebone Rd, Greater London, NW1 5LS, Un... NaN
46 5050c6a6e4b0706cbc520a7f Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 14 Great Marlborough St Ramillies St 52 -0 [{'label': 'display', 'lat': 51.51459009305343... 1118 W1F 7HP GB London Greater London United Kingdom [14 Great Marlborough St (Ramillies St), Londo... NaN
47 4bc4ac9f74a9a593d029d6f6 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False Unit 3, King's Cross St. Pancras Underground S... Euston Road 52 -0 [{'label': 'display', 'lat': 51.53002975905134... 2538 N1 9AL GB London Greater London United Kingdom [Unit 3, King's Cross St. Pancras Underground ... NaN
48 5bddb0084a7aae00395885d5 Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 123 Oxford St NaN 52 -0 [{'label': 'display', 'lat': 51.515875, 'lng':... 1128 W1D 1LT GB London Greater London United Kingdom [123 Oxford St, London, Greater London, W1D 1L... NaN
49 534f9552498e4de1f2d9655c Costa Coffee [{'id': '4bf58dd8d48988d1e0931735', 'name': 'C... v-1590683983 False 3 Southwark St NaN 52 -0 [{'label': 'display', 'lat': 51.50466253737765... 2564 SE1 1RQ GB London Greater London United Kingdom [3 Southwark St, London, Greater London, SE1 1... NaN
In [132]:
# keep only columns that include venue name, and anything that is associated with location
costa_columns = ['name', 'categories'] + [col for col in dataframe.columns if col.startswith('location.')] + ['id']
dfc = dataframe.loc[:, costa_columns]

# function that extracts the category of the venue
def get_category_type(row):
    try:
        categories_list = row['categories']
    except:
        categories_list = row['venue.categories']
        
    if len(categories_list) == 0:
        return None
    else:
        return categories_list[0]['name']

# filter the category for each row
dfc['categories'] = dfc.apply(get_category_type, axis=1)

# clean column names by keeping only last term
dfc.columns = [column.split('.')[-1] for column in dfc.columns]

dfc
Out[132]:
name categories address crossStreet lat lng labeledLatLngs distance postalCode cc city state country formattedAddress neighborhood id
0 Costa Coffee Coffee Shop The Grand Building Trafalgar Square 52 -0 [{'label': 'display', 'lat': 51.50764442847237... 53 WC2N 5EJ GB London Greater London United Kingdom [The Grand Building (Trafalgar Square), London... NaN 4b4b47f5f964a520609626e3
1 Costa Coffee Coffee Shop 15 Regent St Jermyn St 52 -0 [{'label': 'display', 'lat': 51.50879033505443... 462 SW1Y 4LR GB London Greater London United Kingdom [15 Regent St (Jermyn St), London, Greater Lon... NaN 4cda944022bd721e533df047
2 Costa Coffee Coffee Shop 17 Embankment Pl NaN 52 -0 [{'label': 'display', 'lat': 51.50730858076348... 336 WC2N 6NN GB London Greater London United Kingdom [17 Embankment Pl, London, Greater London, WC2... Embankmen 4ae815e0f964a52014ae21e3
3 Costa Coffee Coffee Shop 13 New Row NaN 52 -0 [{'label': 'display', 'lat': 51.51115239980299... 447 WC2N 4LF GB London Greater London United Kingdom [13 New Row, London, Greater London, WC2N 4LF,... NaN 4b24fad1f964a520f66a24e3
4 Costa Coffee Coffee Shop 9-11 Kingsway NaN 52 -0 [{'label': 'display', 'lat': 51.51359089480928... 973 WC2B 6UN GB London Greater London United Kingdom [9-11 Kingsway, London, Greater London, WC2B 6... NaN 4c7f554fd51ea143cc5e5a9f
5 AMT Coffee Coffee Shop St. Thomas Hospital Lambeth Palace Road 51 -0 [{'label': 'display', 'lat': 51.49997320903263... 1015 SE1 7EH GB London Greater London United Kingdom [St. Thomas Hospital (Lambeth Palace Road), Lo... NaN 4b6fc85bf964a52069fc2ce3
6 Soho Coffee company Coffee Shop 65 Kingsway NaN 52 -0 [{'label': 'display', 'lat': 51.51537503662551... 1075 WC2B 6TD GB London Greater London United Kingdom [65 Kingsway, London, Greater London, WC2B 6TD... Holborn and Covent Garden 596e24c212c8f014009d6842
7 Costa Coffee Coffee Shop 200 Piccadilly NaN 52 -0 [{'label': 'display', 'lat': 51.50896578159291... 645 W1J 9HU GB London Greater London United Kingdom [200 Piccadilly, London, Greater London, W1J 9... NaN 4b2630f7f964a5200a7924e3
8 Algerian Coffee Stores Coffee Shop 52 Old Compton St NaN 52 -0 [{'label': 'display', 'lat': 51.51286473760223... 689 W1D 4PB GB London Greater London United Kingdom [52 Old Compton St, London, Greater London, W1... NaN 4aeebda6f964a52038d421e3
9 Costa Coffee Coffee Shop 39 Shelton St NaN 52 -0 [{'label': 'display', 'lat': 51.51407186153086... 777 WC2H 9HJ GB Covent Garden Greater London United Kingdom [39 Shelton St, Covent Garden, Greater London,... NaN 4d7b8859645ea35daeb133f8
10 Despatch Box Coffee Shop Coffee Shop Portcullis House NaN 52 -0 [{'label': 'display', 'lat': 51.50111406437572... 719 SW1 A 2 GB London Greater London United Kingdom [Portcullis House, London, Greater London, SW1... NaN 4cac1b4d36fa6dcb80e6db78
11 Department of Coffee and Social Affairs Coffee Shop 15 Sherwood St Regent St Quadrant 52 -0 [{'label': 'display', 'lat': 51.51087965006803... 694 W1F 7ED GB Soho Greater London United Kingdom [15 Sherwood St (Regent St Quadrant), Soho, Gr... Piccadilly, London, Greater London 551a93a2498ed90a2cc7e544
12 Double Shot Coffee Co. Coffee Shop 38 Tavistock St NaN 52 -0 NaN 757 WC2E 7PB GB London Greater London United Kingdom [38 Tavistock St, London, Greater London, WC2E... NaN 4b7d4467f964a52082b52fe3
13 AMT Coffee Coffee Shop 16 Neal Street NaN 52 -0 [{'label': 'display', 'lat': 51.51370664977727... 737 NaN GB London Greater London United Kingdom [16 Neal Street, London, Greater London, Unite... NaN 4b817ecef964a52033aa30e3
14 Monmouth Coffee Company Coffee Shop 27 Monmouth St NaN 52 -0 [{'label': 'display', 'lat': 51.514314, 'lng':... 780 WC2H 9EU GB Covent Garden Greater London United Kingdom [27 Monmouth St, Covent Garden, Greater London... Holborn and Covent Garden 4ac518edf964a520c1ac20e3
15 Hej Coffee Coffee Shop Strand NaN 52 -0 [{'label': 'display', 'lat': 51.511265, 'lng':... 828 W C2R GB London Greater London United Kingdom [Strand, London, Greater London, W C2R, United... NaN 5a6dfdcf48b04e70ed5493b5
16 Crosstown Doughnuts & Coffee Donut Shop 4 Broadwick St NaN 52 -0 [{'label': 'display', 'lat': 51.51404256630057... 889 W1F 8HJ GB London Greater London United Kingdom [4 Broadwick St, London, Greater London, W1F 8... Soho, London, Greater London 553e368d498ecddb31302a1c
17 Coffee Geek and Friends Coffee Shop Unit 22 Cardinal Place 6 Cathedral Walk 51 -0 [{'label': 'display', 'lat': 51.49763776601168... 1444 SW1E 5JH GB London Greater London United Kingdom [Unit 22 Cardinal Place (6 Cathedral Walk), Lo... NaN 5565c24d498e2885d1b9a54e
18 Press Coffee & Co. Coffee Shop 81 Chancery Ln NaN 52 -0 [{'label': 'display', 'lat': 51.515798, 'lng':... 1439 WC2A 1DD GB London Greater London United Kingdom [81 Chancery Ln, London, Greater London, WC2A ... NaN 56d44205cd10603392e9101e
19 The Somerset Coffee Bar College Cafeteria Strand Campus NaN 52 -0 [{'label': 'display', 'lat': 51.51137166465521... 913 WC2R 2LS GB London Greater London United Kingdom [Strand Campus, London, Greater London, WC2R 2... NaN 5242cbc411d25ddcbaf84656
20 Costa Coffee Coffee Shop 76-78 Upper Ground NaN 52 -0 [{'label': 'display', 'lat': 51.50776564909346... 993 SE1 9PZ GB London Greater London United Kingdom [76-78 Upper Ground, London, Greater London, S... NaN 574ee1f9498ebb08c52ff8cb
21 Costa Coffee Coffee Shop 1 Charlie Chaplin Walk at Waterloo Rd 52 -0 [{'label': 'display', 'lat': 51.50476681331239... 1018 SE1 1XR GB Waterloo Greater London United Kingdom [1 Charlie Chaplin Walk (at Waterloo Rd), Wate... NaN 50b282aae4b0dabb590f2fbe
22 Costa Coffee Coffee Shop 3 Cardinal Walk Victoria St 51 -0 [{'label': 'display', 'lat': 51.49707313663782... 1485 SW1E 5JE GB Victoria Greater London United Kingdom [3 Cardinal Walk (Victoria St), Victoria, Grea... NaN 4c5e9aaf9b28d13a44c35c70
23 The Old Coffee House Pub 49 Beak St NaN 52 -0 [{'label': 'display', 'lat': 51.51262085770566... 894 W1F 9SF GB Soho Greater London United Kingdom [49 Beak St, Soho, Greater London, W1F 9SF, Un... NaN 4ad204d6f964a520dfde20e3
24 Better Coffee Corner Coffee Shop Oasis Sports Centre, 32 Endell St NaN 52 -0 [{'label': 'display', 'lat': 51.515705, 'lng':... 940 WC2H 9AG GB London Greater London United Kingdom [Oasis Sports Centre, 32 Endell St, London, Gr... NaN 58e50bd73ef0f646864352dd
25 Soho Coffee Club Café Dean St NaN 52 -0 [{'label': 'display', 'lat': 51.51527327636101... 978 NaN GB Soho Greater London United Kingdom [Dean St, Soho, Greater London, United Kingdom] NaN 4cc2c86b8062468853762b2f
26 Ralph's Coffee & Bar Café 173 Regent Street NaN 52 -0 [{'label': 'display', 'lat': 51.51214764828749... 1023 W1B 4JQ GB London Greater London United Kingdom [173 Regent Street, London, Greater London, W1... NaN 5883913551d19e062a758a77
27 Notes Coffee Barrows Coffee Shop 60 St Giles High St NaN 52 -0 [{'label': 'display', 'lat': 51.51553615403286... 917 WC2H 8LG GB Greater London Greater London United Kingdom [60 St Giles High St, Greater London, WC2H 8LG... NaN 4f7ac16fe4b0e4c448e2a05b
28 Sharps Coffee Bar Coffee Shop 9 Windmill St NaN 52 -0 [{'label': 'display', 'lat': 51.51880890491309... 1352 W1T 2JF GB Fitzrovia Greater London United Kingdom [9 Windmill St, Fitzrovia, Greater London, W1T... NaN 5221d93b11d2750f339082be
29 TAP Coffee No. 193 Coffee Shop 193 Wardour St btwn Oxford St & Noel St 52 -0 [{'label': 'display', 'lat': 51.51550905, 'lng... 1071 W1F 8ZF GB Soho Greater London United Kingdom [193 Wardour St (btwn Oxford St & Noel St), So... NaN 5082d072e4b09e409c582ab4
30 Costa Coffee Coffee Shop London Waterloo Station (WAT) Opposite Platform 11 52 -0 [{'label': 'display', 'lat': 51.50318004562804... 1137 SE1 8SW GB London Greater London United Kingdom [London Waterloo Station (WAT) (Opposite Platf... NaN 4b9bc455f964a520da2236e3
31 Costa Coffee Coffee Shop 11 Argyll St NaN 52 -0 [{'label': 'display', 'lat': 51.51475276642239... 1236 W1F 7TX GB London Greater London United Kingdom [11 Argyll St, London, Greater London, W1F 7TX... NaN 4b25316df964a520b96d24e3
32 Costa Coffee Coffee Shop 4 Great Portland St NaN 52 -0 [{'label': 'display', 'lat': 51.51573111967288... 1300 W1W 8QJ GB London Greater London United Kingdom [4 Great Portland St, London, Greater London, ... NaN 4c3d6ed94bc9a5939b07d471
33 Flat Cap Coffee Co Coffee Shop 4 Strutton Ground at Old Pye St 51 -0 [{'label': 'display', 'lat': 51.49749647419568... 1175 SW1P 2HR GB London Greater London United Kingdom [4 Strutton Ground (at Old Pye St), London, Gr... NaN 4b0c6aa1f964a520cd3c23e3
34 Coffee Republic Coffee Shop 2 South Molton St NaN 52 -0 [{'label': 'display', 'lat': 51.51460380934164... 1564 W1K 5QA GB London Greater London United Kingdom [2 South Molton St, London, Greater London, W1... NaN 4b5201d2f964a520d96027e3
35 Costa Coffee Coffee Shop 226 High Holborn at Kingsway 52 -0 [{'label': 'display', 'lat': 51.517563, 'lng':... 1253 WC1V 7DZ GB London Greater London United Kingdom [226 High Holborn (at Kingsway), London, Great... NaN 4ba0a226f964a520237537e3
36 Department of Coffee and Social Affairs Coffee Shop 114 Tottenham Ct Rd at Midford Pl 52 -0 [{'label': 'display', 'lat': 51.52339592535782... 1902 W1T 5AH GB Bloomsbury Greater London United Kingdom [114 Tottenham Ct Rd (at Midford Pl), Bloomsbu... NaN 4e143ca37d8b4c0d630c715b
37 Coffee on Ground Coffee Shop Debenhams 334-348 Oxford St 52 -0 [{'label': 'display', 'lat': 51.515263, 'lng':... 1696 NaN GB London Greater London United Kingdom [Debenhams (334-348 Oxford St), London, Greate... NaN 53384902498e0f1c0982f993
38 Rachel's Nails & Coffee Nail Salon 34 Windmill Street NaN 52 -0 [{'label': 'display', 'lat': 51.518882, 'lng':... 1358 W1T 2JR GB London Greater London United Kingdom [34 Windmill Street, London, Greater London, W... NaN 5ab688ff037be12b6480737e
39 Monmouth Coffee Company Coffee Shop 2 Park St The Borough 52 -0 [{'label': 'display', 'lat': 51.505536, 'lng':... 2513 SE1 9AB GB London Greater London United Kingdom [2 Park St (The Borough), London, Greater Lond... NaN 4ad9a8acf964a5205f1a21e3
40 International Coffee Organization Office 22 Berners St NaN 52 -0 [{'label': 'display', 'lat': 51.51778967616555... 1327 W1T 3DD GB London Greater London United Kingdom [22 Berners St, London, Greater London, W1T 3D... NaN 4e9fe923b634b81226148799
41 Coffee Republic Coffee Shop 99 Tottenham Court Rd NaN 52 -0 [{'label': 'display', 'lat': 51.52228710523008... 1762 W1T 4TS GB Fitzrovia Greater London United Kingdom [99 Tottenham Court Rd, Fitzrovia, Greater Lon... NaN 4d09d8ce33d6b60ce15f9785
42 Igor's Coffee Food Truck Old St NaN 52 -0 [{'label': 'display', 'lat': 51.50826928107465... 1134 NaN GB Shoreditch Greater London United Kingdom [Old St, Shoreditch, Greater London, United Ki... Shoreditch, London, Greater London 4d749547d0c737046217f217
43 2 Love Tea And Coffee Coffee Shop Lambeth Palace Rd NaN 51 -0 [{'label': 'display', 'lat': 51.49608859432227... 1336 SE1 GB London Greater London United Kingdom [Lambeth Palace Rd, London, Greater London, S... NaN 4e7c4d38183853fb9f712dcb
44 Notes Coffee Barrows Coffee Shop 186a Fleet St NaN 52 -0 [{'label': 'display', 'lat': 51.51409489806739... 1438 EC4A 2HR GB London Greater London United Kingdom [186a Fleet St, London, Greater London, EC4A 2... NaN 4e8ac70a8b810d8892781ae2
45 Costa Coffee Coffee Shop 311-318 High Holborn NaN 52 -0 [{'label': 'display', 'lat': 51.51828657519206... 1585 WC1V 7BB GB Greater London Greater London United Kingdom [311-318 High Holborn, Greater London, WC1V 7B... NaN 4b9fae0bf964a5203e3437e3
46 Department of Coffee and Social Affairs Coffee Shop 14-16 Leather Ln NaN 52 -0 [{'label': 'display', 'lat': 51.51931845391665... 1849 EC1N 7SU GB London Greater London United Kingdom [14-16 Leather Ln, London, Greater London, EC1... NaN 4cfa6667ee9cb60c44fd89ad
47 Coffee, Cake & Kink HQ Office 38 Mount Pleasant NaN 52 -0 [{'label': 'display', 'lat': 51.52234330631439... 1964 WC1X 0AN GB Camden Town Greater London United Kingdom [38 Mount Pleasant, Camden Town, Greater Londo... NaN 4c99dc8ba004a1cd8dee426e
48 Costa Coffee Coffee Shop 82 Gower St in Waterstones 52 -0 [{'label': 'display', 'lat': 51.52223061484879... 1691 WC1E 6EQ GB Camden Town Greater London United Kingdom [82 Gower St (in Waterstones), Camden Town, Gr... NaN 4bc9c597b6c49c74bce88e91
49 Prufrock Coffee Coffee Shop 23-25 Leather Ln NaN 52 -0 [{'label': 'display', 'lat': 51.51992634, 'lng... 1886 EC1N 7TE GB London Greater London United Kingdom [23-25 Leather Ln, London, Greater London, EC1... Holborn and Covent Garden, London, Greater London 4d5d33e3fb186dcb4030099b
In [133]:
# Generate map centered around the City of London
costa_map = folium.Map(location=[latitude, longitude], zoom_start=13) 

# add a red circle marker to represent the City of London Borough
folium.features.CircleMarker(
    [latitude, longitude],
    radius=10,
    color='red',
    popup='City of London',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(costa_map)

# add the Costa Coffee Shops as orange circle markers
for lat, lng, label in zip(dfc.lat, dfc.lng, dfc.categories):
    folium.features.CircleMarker(
        [lat, lng],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(costa_map)
    
# display map
costa_map
Out[133]:

Overlay the different Coffee shop locations onto one map

In [134]:
# generate map centred around the City of London Borough
coffee_map = folium.Map(location=[latitude, longitude], zoom_start=13)

# add a red circle marker to represent the City of London Borough
folium.features.CircleMarker(
    [latitude, longitude],
    radius=10,
    color='red',
    popup='City of London',
    fill = True,
    fill_color = 'red',
    fill_opacity = 0.6
).add_to(coffee_map)

# add the Starbucks Coffee Shops as green circle markers
for Latitude, Longitude, label in zip(dfs.Latitude, dfs.Longitude, dfs.Brand):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='green',
        popup=label,
        fill = True,
        fill_color='green',
        fill_opacity=0.1
    ).add_to(coffee_map)
    
# add the different Coffee Shops as blue circle markers
#for lat, lng, label in zip(dataframe_filtered.lat, dataframe_filtered.lng, dataframe_filtered.categories):
    folium.features.CircleMarker(
        [lat, lng],
        radius=5,
        color='blue',
        popup=label,
        fill = True,
        fill_color='blue',
        fill_opacity=0.5
    ).add_to(coffee_map) 
    
# add the Costa Coffee Shops as orange circle markers
for lat, lng, label in zip(dfc.lat, dfc.lng, dfc.categories):
    folium.features.CircleMarker(
        [lat, lng],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.6
    ).add_to(coffee_map)    
    
    
# display map
coffee_map
Out[134]:
In [135]:
dfs['Brand'].astype(str)
dfs.dtypes
Out[135]:
Brand              object
Ownership Type     object
Street Address     object
City               object
Country            object
Postcode           object
Longitude         float64
Latitude          float64
dtype: object
In [ ]:
 
Webscrape the Costa Coffee shop information
In [136]:
# Costa coffee store locator
# This is a dynamic website and needs better execution (selenium) to extract the information
c_url = 'https://www.costa.co.uk/locations/store-locator'
cpage = requests.get(c_url)
cpage
Out[136]:
<Response [200]>
In [ ]:
# Here, Selenium accesses the Chrome browser driver in incognito mode and without actually opening a browser window(headless argument).
# With my limited knowledge of interactive webscraping I was unable to scrape the costa website effectively
#options = webdriver.ChromeOptions()
#options.add_argument('--ignore-certificate-errors')
#options.add_argument('--incognito')
#options.add_argument('--headless')
#driver = webdriver.Chrome("/usr/local/bin/chromedriver", chrome_options=options)
In [ ]:
# Link (get) the URL page up with the driver

#driver.get("sb_url")
#buttons = driver.find_elements_by_class_name("linkOverlay__primary overlayLink")
#for x in range(len(buttons)):
#  if buttons[x].is_displayed():
#      driver.execute_script("arguments[0].select();", buttons[x])
#      time.sleep(1)
#page_source = driver.page_source
In [ ]:
# Use Beautiful Soup for data extraction

#soup = BeautifulSoup(page_source, 'lxml')
#aria_label = []
#aria_label_selector = soup.find_all('div', class_='aria_labelSelector')
#for aria_label_selector in aria_label_selector:
#    aria_label_div = aria_label_selector.find('div', class_='dyn_full_review')
#    if aria_label_div is None:
#        aria_label_div = aria_label_selector.find('div', class_='basic_review')
#    review = review_div.find('div', class_='entry').find('p').get_text()
#    review = review.strip()
#    reviews.append(review)

Combine the London population density map with the various coffee shop data maps

In [137]:
# London latitude and longitude values
latitude = 51.509865
longitude = -0.118092
ldn_borough_geo = '/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./london_boroughs.json'

# Create map
ldn_map = folium.Map(
       location=[latitude,longitude],
       zoom_start=12)

# Use json file
ldn_map.choropleth(
       geo_data=ldn_borough_geo, # what is the name of the json file
       data=dfld, # where is the applicable data stored
       columns=['Borough', 'Population / Area'], # which columns in the df do you want to link to
       key_on='feature.properties.name', # this is according to the json file
       fill_color='YlOrRd',
       fill_opacity='0.5',
       line_opacity='0.4',
       legend_name='Population / Sq Mile in London, by Borough')

# add the Starbucks Coffee Shops as green circle markers
for Latitude, Longitude, label in zip(dfs.Latitude, dfs.Longitude, dfs.Brand):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='green',
        popup=label,
        fill = True,
        fill_color='green',
        fill_opacity=0.1
    ).add_to(ldn_map)
    
# add the Costa Coffee Shops as orange circle markers
for lat, lng, label in zip(dfc.lat, dfc.lng, dfc.categories):
    folium.features.CircleMarker(
        [lat, lng],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(ldn_map) 
    
# add the Islington Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(islington_dataframe_filtered.lat, islington_dataframe_filtered.lng, islington_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(ldn_map)
    
# add the Tower Hamlets Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(tower_dataframe_filtered.lat, tower_dataframe_filtered.lng, tower_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(ldn_map)
    
# add the Hackney Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(hackney_dataframe_filtered.lat, hackney_dataframe_filtered.lng, hackney_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(ldn_map)    
    
# add the Kensington & Chelsea Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(ken_dataframe_filtered.lat, ken_dataframe_filtered.lng, ken_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(ldn_map)    
    
# add the Lambeth Costa Coffee Shops as orange circle markers
for Latitude, Longitude, label in zip(l_dataframe_filtered.lat, l_dataframe_filtered.lng, l_dataframe_filtered.categories):
    folium.features.CircleMarker(
        [Latitude, Longitude],
        radius=5,
        color='orange',
        popup=label,
        fill = True,
        fill_color='orange',
        fill_opacity=0.3
    ).add_to(ldn_map)    
        
# display the map
ldn_map
Out[137]:

Get London borough boundaries

Get Data from London gov

In [138]:
# Import clean data that's been downloaded from Data London Gov
filename = '/Users/renierswanepoel/Desktop/projects/Coursera_Capstone./london-borough-profiles-2016 Data set.csv'
In [139]:
# Transforming the file into a dataframe
df1 = pd.read_csv(filename)
df1
Out[139]:
Code New code Area name Inner/ Outer London GLA Population Estimate 2016 GLA Household Estimate 2016 Inland Area (Hectares) Population density (per hectare) 2016 Average Age, 2016 Proportion of population aged 0-15, 2016 Proportion of population of working-age, 2016 Proportion of population aged 65 and over, 2016 Net internal migration (2014) Net international migration (2014) Net natural change (2014) % of resident population born abroad (2014) Largest migrant population by country of birth (2011) % of largest migrant population (2011) Second largest migrant population by country of birth (2011) % of second largest migrant population (2011) Third largest migrant population by country of birth (2011) % of third largest migrant population (2011) % of population from BAME groups (2016) % people aged 3+ whose main language is not English (2011 Census) Overseas nationals entering the UK (NINo), (2014/15) New migrant (NINo) rates, (2014/15) Largest migrant population arrived during 2014/15 Second largest migrant population arrived during 2014/15 Third largest migrant population arrived during 2014/15 Employment rate (%) (2015) Male employment rate (2015) Female employment rate (2015) Unemployment rate (2015) Youth Unemployment (claimant) rate 18-24 (Dec-14) Proportion of 16-18 year olds who are NEET (%) (2014) Proportion of the working-age population who claim out-of-work benefits (%) (Aug-2015) % working-age with a disability (2015) Proportion of working age people with no qualifications (%) 2015 Proportion of working age with degree or equivalent and above (%) 2015 Gross Annual Pay, (2015) Gross Annual Pay - Male (2015) Gross Annual Pay - Female (2015) Modelled Household median income estimates 2012/13 % adults that volunteered in past 12 months (2010/11 to 2012/13) Number of jobs by workplace (2014) % of employment that is in public sector (2014) Jobs Density, 2014 Number of active businesses, 2014 Two-year business survival rates (started in 2012) Crime rates per thousand population 2014/15 Fires per thousand population (2014) Ambulance incidents per hundred population (2014) Median House Price, 2014 Average Band D Council Tax charge (£), 2015/16 New Homes (net) 2014/15 (provisional) Homes Owned outright, (2014) % Being bought with mortgage or loan, (2014) % Rented from Local Authority or Housing Association, (2014) % Rented from Private landlord, (2014) % % of area that is Greenspace, 2005 Total carbon emissions (2013) Household Waste Recycling Rate, 2014/15 Number of cars, (2011 Census) Number of cars per household, (2011 Census) % of adults who cycle at least once per month, 2013/14 Average Public Transport Accessibility score, 2014 Achievement of 5 or more A*- C grades at GCSE or equivalent including English and Maths, 2013/14 Rates of Children Looked After (2015) % of pupils whose first language is not English (2015) % children living in out-of-work households (2014) Male life expectancy, (2012-14) Female life expectancy, (2012-14) Teenage conception rate (2014) Life satisfaction score 2011-14 (out of 10) Worthwhileness score 2011-14 (out of 10) Happiness score 2011-14 (out of 10) Anxiety score 2011-14 (out of 10) Childhood Obesity Prevalance (%) 2014/15 People aged 17+ with diabetes (%) Mortality rate from causes considered preventable 2012/14 Political control in council Proportion of seats won by Conservatives in 2014 election Proportion of seats won by Labour in 2014 election Proportion of seats won by Lib Dems in 2014 election Turnout at 2014 local elections
0 NaN NaN NaN NaN NaN NaN NaN NaN nan nan nan nan NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN nan NaN NaN NaN nan NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN nan nan NaN nan NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN nan NaN NaN NaN NaN NaN nan NaN NaN NaN nan nan nan nan NaN nan NaN NaN NaN NaN NaN NaN
1 E09000001 E09000001 City of London Inner London 8,548 5,179 290.4 28.9 43 27 91 9 138 252 35 . United States 2.8 France 2.0 Australia 1.9 27.5 17.1 892 151 France United States India 65 . . . 1.2 . 3.8 . . . . . . £99,390 . 500,400 3 85 19,250 63 . 12.3 . 765,000 943 230 . . . . 4.8 1,417.5 34.4 1,692 0 . 7.9 78.6 84 . 9 . . . 7 7 6 6 NaN 3 128.8 . . . . .
2 E09000002 E09000002 Barking and Dagenham Outer London 205,773 76,841 3,610.8 57.3 33 21 86 14 -1118 2543 2509 37.4 Nigeria 4.7 India 2.3 Pakistan 2.3 49.5 18.7 7,727 62 Romania Bulgaria Lithuania 66 75.6 56.5 11.0 7.3 5.7 11.7 17.2 11.3 32.2 £28,428 £29,792 £25,251 £34,080 21 58,900 21 0 5,690 73 83.4 3.0 13.7 215,000 1332 510 16.4 27.4 35.9 20.3 33.6 783.2 23.4 56,966 1 6.5 3.0 58.0 77 47.2 22 77.6 82.1 32.4 7 8 7 3 25.3 7 227.6 Lab 0.0 100.0 0.0 36.5
3 E09000003 E09000003 Barnet Outer London 385,108 149,147 8,674.8 44.5 37 21 83 17 -1884 4770 2938 35.9 India 3.1 Poland 2.4 Iran 2.0 38.7 23.4 14,412 59 Romania Poland Italy 68 74.5 62.9 8.5 3.5 2.5 6.7 14.9 5.2 49.0 £33,084 £37,058 £30,449 £54,530 33 167,300 19 1 24,555 70 62.7 1.6 11.1 400,000 1397 1,320 32.4 25.2 11.1 31.1 41.3 1,552.7 38.0 144,717 1 12.1 3.0 67.3 34 43.4 11 82.1 85.1 12.8 7 8 7 3 18.4 6 133.8 Cons 50.8 47.6 1.6 40.5
4 E09000004 E09000004 Bexley Outer London 243,303 97,233 6,058.1 39.9 39 21 89 11 1273 699 1195 16.1 Nigeria 2.6 India 1.5 Ireland 0.9 21.4 6.0 2,108 14 Romania Nigeria Poland 75 82.1 68.5 7.6 3.8 3.4 7.3 15.9 10.8 33.5 £32,040 £36,020 £25,776 £44,430 22 80,700 16 1 8,430 75 51.8 2.3 11.8 250,000 1446 810 38.1 35.3 15.2 11.4 31.7 1,060.9 54.0 108,507 1 9.2 2.6 60.3 50 15.0 15 80.4 84.4 19.5 7 8 7 3 21.4 7 164.3 Cons 71.4 23.8 0.0 39.6
5 E09000005 E09000005 Brent Outer London 328,568 119,166 4,323.3 76.1 36 20 82 18 -6932 6717 3694 56.2 India 9.2 Poland 3.4 Ireland 2.9 64.9 37.2 25,130 115 Romania Italy Portugal 70 76.0 62.6 7.5 6.1 2.6 9.0 17.7 6.2 45.1 £29,777 £31,149 £27,653 £39,630 17 133,600 18 1 14,680 70 78.8 1.8 12.1 385,000 1354 1,560 22.2 22.6 20.4 34.8 21.9 1,292.6 35.2 87,802 1 11.7 3.7 60.1 44 62.7 16 80.1 85.1 18.5 7 7 7 3 23.9 8 169.4 Lab 9.5 88.9 1.6 36.3
6 E09000006 E09000006 Bromley Outer London 326,560 139,654 15,013.5 21.7 40 16 88 12 1169 728 1486 17.2 India 1.1 Ireland 1.1 Nigeria 0.7 18.9 5.8 2,778 14 Romania Italy Poland 75 80.4 70.4 5.3 3.5 4.3 6.4 15.9 4.3 46.7 £36,498 £42,464 £32,600 £55,140 29 127,800 14 1 14,825 77 64.1 2.3 11.2 335,000 1325 410 37.8 34.9 13.2 14.1 57.8 1,334.7 48.0 153,908 1 12.2 2.8 68.0 37 10.8 12 81.4 84.9 16.7 8 8 7 3 16.5 5 148.5 Cons 85.0 11.7 0.0 40.8
7 E09000007 E09000007 Camden Inner London 240,595 106,518 2,178.9 109.8 36 9 83 17 -2790 6288 1642 42.4 United States 2.8 Bangladesh 2.7 Ireland 2.4 34.6 23.5 10,703 64 Italy France Spain 69 72.2 66.1 4.0 5.0 4.4 9.2 21.3 6.1 61.1 £39,610 £42,905 £35,936 £67,990 22 377,400 12 2 29,020 69 123.5 2.7 14.8 675,000 1337 440 18.5 15.1 34.4 32.0 24.8 1,540.5 26.3 46,601 0 15.1 5.7 62.7 43 55.4 19 81.8 86.7 16.8 7 7 7 4 20.8 4 163.8 Lab 22.2 74.1 1.9 38.7
8 E09000008 E09000008 Croydon Outer London 383,408 156,979 8,650.4 44.4 37 22 87 13 -2362 2189 3443 29.7 India 3.6 Jamaica 2.5 Ghana 1.5 49.9 14.5 7,902 32 Romania Poland Bulgaria 75 81.8 69.5 4.1 5.3 3.3 9.1 17.5 7.0 40.6 £32,887 £34,300 £30,509 £45,120 27 141,600 20 1 14,400 74 77.0 2.2 12.8 265,000 1466 1,520 30.8 33.6 16.7 18.6 37.1 1,452.2 39.9 140,049 1 6.8 3.2 57.7 87 30.2 16 80.3 83.6 28.4 7 8 7 3 23.8 6 178.2 Lab 42.9 57.1 0.0 38.6
9 E09000009 E09000009 Ealing Outer London 348,533 130,934 5,554.4 63.5 36 21 88 12 -6391 2291 3708 45.5 India 7.6 Poland 6.4 Ireland 2.3 53.5 33.9 15,143 66 Poland Romania Italy 73 81.2 63.8 5.8 5.2 3.0 8.6 15.2 9.1 49.7 £28,978 £30,800 £27,807 £45,690 32 160,500 14 1 17,475 74 75.5 1.9 11.3 388,000 1355 900 20.1 30.2 14.3 35.0 30.9 1,567.3 40.1 112,845 1 13.4 3.3 62.1 44 59.8 15 80.6 84.2 17.8 7 8 7 4 23.3 7 163.5 Lab 17.4 76.8 5.8 41.2
10 E09000010 E09000010 Enfield Outer London 330,968 129,014 8,083.2 41.0 36 23 87 13 -1892 2983 2948 32.8 Turkey 4.5 Cyprus (Not otherwise specified) 3.6 Poland 1.9 42.3 22.9 9,593 46 Romania Bulgaria Poland 73 80.4 66.0 3.8 7.3 3.1 10.1 18.4 4.5 43.4 £31,094 £34,234 £27,901 £41,250 22 128,800 22 1 13,015 74 69.4 2.2 12.2 285,000 1395 400 25.6 36.2 17.2 21.0 45.6 1,397.5 38.5 119,653 1 7.9 3.0 59.9 44 46.3 20 80.7 84.1 24.6 7 8 7 3 25.4 7 152.0 Lab 34.9 65.1 0.0 38.2
11 E09000011 E09000011 Greenwich Outer London 275,868 111,783 4,733.4 58.8 35 22 89 11 -1262 2793 2895 32.9 Nigeria 5.1 Nepal 1.9 India 1.7 40.3 16.9 7,184 40 Romania Nigeria Bulgaria 72 77.9 66.3 8.1 6.2 5.0 10.4 20.2 10.6 42.2 £31,757 £34,835 £28,911 £44,370 17 94,700 27 1 8,975 71 79.4 2.5 11.9 317,000 1276 1,150 19.2 26.9 34.2 19.7 34.4 1,004.5 34.3 78,185 1 11.6 3.4 58.8 80 38.7 19 79.0 82.5 28.1 7 8 7 3 24.5 6 193.2 Lab 15.7 84.3 0.0 37.3
12 E09000012 E09000012 Hackney Inner London 270,912 113,537 1,904.9 141.1 33 20 93 7 -226 2592 3405 38.9 Turkey 3.6 Nigeria 2.7 Jamaica 1.8 43.6 24.1 9,424 50 Italy Spain France 69 72.8 65.3 5.9 6.3 3.0 11.7 17.9 10.8 49.2 £32,199 . £32,205 £42,690 30 132,800 18 1 16,095 74 99.6 2.7 11.5 433,000 1293 1,260 11.1 19.8 45.4 23.3 23.2 877.8 25.3 41,800 0 24.1 4.9 60.6 58 50.8 22 78.5 83.3 24.7 7 7 7 4 25.6 6 210.6 Lab 7.0 87.7 5.3 39.4
13 E09000013 E09000013 Hammersmith and Fulham Inner London 183,354 82,513 1,639.7 111.8 36 17 90 10 -3248 1277 1681 41.5 France 2.7 Ireland 2.7 Australia 2.5 33.7 22.7 10,114 78 Italy Spain France 78 80.9 74.2 4.7 3.6 2.5 9.0 12.9 4.9 67.5 £38,029 . £34,539 £62,910 30 149,500 16 1 13,465 69 113.2 2.0 12.2 661,000 1023 1,360 19.1 21.8 25.9 33.1 19.1 971.3 20.7 43,843 0 24.0 4.7 60.5 55 45.8 18 79.7 84.1 22.4 7 8 7 3 23.3 4 187.4 Lab 43.5 56.5 0.0 37.6
14 E09000014 E09000014 Haringey Inner London 274,803 113,582 2,959.8 92.7 35 20 91 9 -4412 5559 3006 39.6 Poland 4.3 Turkey 4.0 Jamaica 2.0 38.2 29.7 17,549 93 Romania Bulgaria Italy 71 77.6 64.8 5.7 7.1 3.5 10.6 16.3 8.8 49.2 £30,931 £32,000 £29,224 £45,860 30 91,500 18 0 11,875 71 90.2 2.1 12.3 405,000 1479 130 18.0 24.7 33.4 23.9 25.5 891.6 37.3 61,515 1 15.2 4.3 59.7 75 52.3 20 80.1 84.9 22.6 7 8 7 3 22.6 6 183.4 Lab 0.0 84.2 15.8 38.1
15 E09000015 E09000015 Harrow Outer London 250,703 91,390 5,046.3 49.8 38 21 85 15 -2606 3030 2182 50.7 India 9.0 Kenya 4.9 Sri Lanka 4.3 61.8 28.5 11,239 71 Romania Poland India 74 83.1 64.7 4.6 4.3 1.5 6.0 13.9 4.2 47.9 £32,529 £36,355 £29,621 £49,060 39 88,600 14 1 14,000 75 50.4 1.3 9.8 370,000 1529 410 33.5 32.8 8.9 24.6 34.6 837.7 45.1 100,326 1 5.1 2.9 66.4 29 61.6 10 82.7 86.1 11.0 7 7 7 3 21.1 8 134.2 Lab 41.3 54.0 1.6 40.7
16 E09000016 E09000016 Havering Outer London 251,611 102,954 11,235.0 22.3 40 20 82 18 2244 673 977 11.9 Ireland 1.1 India 1.0 Nigeria 0.9 15.7 4.6 2,459 16 Romania Lithuania Bulgaria 76 81.3 71.8 5.3 3.8 4.0 7.5 18.2 10.5 26.0 £32,274 £36,530 £28,243 £44,430 17 91,300 21 1 9,445 77 62.9 2.5 12.9 250,000 1514 640 35.2 33.9 17.2 13.8 59.3 1,161.2 32.4 117,634 1 9.2 2.5 59.8 45 12.5 15 80.2 83.9 22.8 7 8 7 3 20.8 6 159.3 No Overall Control 40.7 1.9 0.0 43.1
17 E09000017 E09000017 Hillingdon Outer London 299,474 109,932 11,570.1 25.8 36 21 87 13 -800 3970 2636 33.1 India 5.7 Pakistan 1.8 Ireland 1.6 45.7 18.8 6,554 34 Romania India Poland 73 80.7 65.9 5.8 3.2 2.4 7.2 17.9 8.7 40.2 £32,989 £34,409 £30,515 £44,950 24 220,900 11 1 12,485 74 76.6 2.6 14.7 307,000 1408 550 22.2 33.0 16.6 28.2 49.2 1,998.4 43.8 122,486 1 13.3 2.4 62.0 48 42.8 14 80.4 83.9 20.5 7 8 7 3 19.8 6 170.1 Cons 64.6 35.4 0.0 36.1
18 E09000018 E09000018 Hounslow Outer London 272,102 104,474 5,597.8 48.9 36 21 89 11 -3678 3607 2990 47.8 India 10.7 Poland 4.1 Pakistan 2.8 51.6 28.7 11,132 62 Romania Poland India 74 84.7 63.2 4.3 4.9 3.2 7.5 17.6 6.5 45.5 . . . £44,490 27 165,700 12 1 13,035 74 79.2 2.1 12.1 319,950 1375 400 25.5 27.0 19.2 28.3 39.6 1,420.7 34.5 94,042 1 15.3 3.0 63.2 48 58.8 15 80.0 83.9 25.0 7 8 7 3 22.8 6 165.8 Lab 18.3 81.7 0.0 36.8
19 E09000019 E09000019 Islington Inner London 228,397 103,612 1,485.7 153.0 35 16 91 9 -1067 4620 1826 36.8 Ireland 2.8 Turkey 1.8 United States 1.5 32.0 19.9 9,435 57 Italy France Spain 73 78.2 67.0 4.5 6.5 5.2 11.6 14.6 6.2 62.7 £35,476 £39,361 £31,994 £54,950 31 231,500 14 1 18,710 69 121.2 2.6 13.9 530,000 1276 500 15.4 23.5 35.3 25.5 12.4 1,052.1 32.8 38,629 0 21.0 5.7 59.9 90 45.2 26 79.0 83.5 20.2 7 7 7 4 22.8 5 202.8 Lab 0.0 97.9 0.0 38.4
20 E09000020 E09000020 Kensington and Chelsea Inner London 158,447 79,735 1,212.4 129.2 39 16 86 14 -1580 1059 1088 54.7 United States 5.0 France 4.2 Italy 2.7 30.0 28.0 7,676 70 Italy France Spain 68 76.3 60.4 4.2 4.5 3.6 7.8 14.3 5.2 65.2 . . . £116,350 31 143,500 15 1 13,635 69 120.9 2.0 12.7 1,195,000 1078 980 22.6 15.1 29.1 33.1 15.1 1,236.0 25.3 44,536 1 16.2 5.8 68.7 38 51.7 12 83.3 86.4 14.2 8 8 8 3 21.5 4 136.3 Cons 74.0 24.0 2.0 29.8
21 E09000021 E09000021 Kingston upon Thames Outer London 173,853 69,132 3,726.1 46.3 37 19 87 13 -188 2136 1178 29.2 Sri Lanka 2.2 India 1.8 Korea (South) 1.4 30.4 16.4 3,157 28 Bulgaria Poland Romania 74 80.9 67.8 4.5 2.8 3.9 5.1 15.3 5.9 53.7 £36,767 £40,000 £32,928 £56,920 43 83,700 17 1 8,520 79 58.5 1.8 11.1 385,000 1675 530 27.7 38.9 10.7 22.4 36.4 752.4 45.7 70,421 1 21.1 2.9 68.6 32 32.6 9 82.0 84.6 15.3 7 8 7 3 15.8 5 140.6 Cons 58.3 4.2 37.5 43.1
22 E09000022 E09000022 Lambeth Inner London 325,455 142,382 2,681.0 121.4 34 18 92 8 -1908 2645 3230 33.6 Jamaica 3.2 Portugal 2.3 Poland 2.3 41.5 20.3 12,764 54 Spain Italy Portugal 78 82.3 74.6 5.9 5.2 2.2 9.8 16.1 6.2 65.0 £33,341 . £30,732 £48,610 32 184,000 23 1 20,900 68 104.6 2.5 13.3 420,000 1239 1,410 10.9 24.9 29.8 34.4 17.3 1,257.3 28.3 66,791 0 20.2 5.0 57.1 78 47.1 22 78.9 83.3 33.8 7 7 7 4 27.1 5 205.0 Lab 4.8 93.7 0.0 34.5
23 E09000023 E09000023 Lewisham Inner London 299,817 128,966 3,514.9 84.7 35 21 91 9 -787 3234 3292 30.9 Jamaica 3.5 Nigeria 3.5 Poland 1.6 47.4 16.5 8,482 42 Romania Italy Spain 76 79.6 72.4 5.7 7.5 3.5 10.8 16.5 5.8 53.3 £31,783 £32,738 £30,048 £43,360 28 90,000 25 0 9,625 75 77.0 2.2 12.0 315,000 1355 1,470 16.5 31.7 28.1 23.6 22.5 930.3 17.1 76,507 1 13.1 4.1 56.3 73 30.7 21 79.0 83.4 31.3 7 8 7 3 24.2 6 190.8 Lab 0.0 98.1 0.0 37.2
24 E09000024 E09000024 Merton Outer London 207,141 83,446 3,762.5 55.7 37 20 88 12 -2365 540 2115 41.1 Poland 3.5 Sri Lanka 3.2 South Africa 2.8 36.7 21.1 6,730 49 Poland Romania Bulgaria 79 86.3 71.4 4.6 4.7 4.3 6.3 13.5 4.7 58.0 £33,122 £36,763 £30,307 £57,160 22 96,800 12 1 11,225 72 59.7 1.8 10.4 385,000 1401 430 21.7 32.7 16.2 29.3 34.6 844.6 37.5 72,777 1 19.4 3.4 67.8 34 41.9 12 80.4 84.2 19.7 7 8 7 4 21.6 6 161.8 Lab 33.3 60.0 1.7 41.3
25 E09000025 E09000025 Newham Inner London 337,378 116,187 3,619.8 93.5 32 22 93 7 -8534 9518 5092 51.8 India 8.7 Bangladesh 6.8 Pakistan 5.3 73.1 41.4 26,478 116 Romania Bulgaria India 66 75.0 56.1 9.1 7.0 4.3 9.2 12.7 11.0 43.4 £27,174 £28,160 £25,055 £34,260 8 111,100 23 0 9,645 68 90.8 2.5 12.2 250,000 1241 2,050 9.4 16.7 31.4 42.5 23.9 1,441.6 17.2 61,092 1 7.1 3.9 55.7 52 70.8 18 78.5 83.0 22.5 7 7 7 3 27.4 8 193.4 Lab 0.0 100.0 0.0 40.5
26 E09000026 E09000026 Redbridge Outer London 301,022 109,114 5,641.9 53.3 36 23 88 12 -1622 3403 3003 40.1 India 7.6 Pakistan 5.3 Sri Lanka 2.6 62.7 24.6 10,237 54 Romania India Italy 68 79.1 57.6 7.9 5.4 3.3 6.6 17.1 10.2 44.7 £35,665 £39,266 £30,118 £45,380 25 90,700 23 0 13,160 71 69.7 1.9 11.3 301,500 1391 260 29.5 34.9 11.3 24.1 40.6 963.5 28.7 106,339 1 9.5 3.0 68.7 29 61.1 12 80.9 84.6 18.5 7 8 7 3 22.9 8 141.9 Lab 39.7 55.6 4.8 39.7
27 E09000027 E09000027 Richmond upon Thames Outer London 196,602 84,615 5,740.7 34.3 39 20 85 15 208 426 1610 24.2 Ireland 1.8 South Africa 1.4 United States 1.4 15.7 10.4 2,536 20 Poland Italy Spain 80 82.1 77.2 3.8 2.9 4.3 4.7 10.8 3.2 69.5 £39,563 £42,896 £34,653 £76,610 49 95,900 11 1 13,650 76 56.3 1.5 9.7 535,000 1582 240 30.9 38.4 8.7 21.9 50.8 880.9 41.2 84,918 1 31.7 3.1 70.5 22 20.9 6 82.4 86.0 12.6 8 8 7 3 11.2 4 137.4 Cons 72.2 0.0 27.8 46.1
28 E09000028 E09000028 Southwark Inner London 310,642 132,080 2,886.2 108.2 34 18 92 8 -3538 4210 3384 35.9 Nigeria 4.7 Jamaica 2.0 Ireland 1.7 45.7 19.6 12,955 58 Spain Italy Romania 74 79.8 68.6 7.7 6.2 2.0 10.2 16.8 7.6 56.8 £34,537 £36,067 £32,600 £48,000 26 285,900 19 1 15,860 71 100.6 3.0 13.6 420,000 1207 1,140 10.1 26.3 37.2 26.4 24.9 1,454.5 34.6 60,438 0 15.6 4.9 61.2 82 41.9 22 78.9 83.9 27.4 7 8 7 3 28.0 6 207.5 Lab 3.2 76.2 20.6 36.2
29 E09000029 E09000029 Sutton Outer London 201,751 84,612 4,384.7 46.1 39 21 85 15 594 465 1164 26.4 Sri Lanka 1.8 India 1.7 Ireland 1.2 25.0 10.0 1,945 15 Romania Bulgaria Poland 78 86.2 70.5 5.5 3.4 3.2 6.2 14.4 4.3 42.5 £31,387 £36,168 £26,404 £49,170 24 78,600 19 1 8,155 77 55.9 2.0 11.3 285,000 1459 430 25.7 41.8 11.6 20.5 32.0 774.4 37.6 91,266 1 12.5 2.9 67.4 50 22.9 12 80.9 83.4 17.3 7 8 7 3 17.4 6 163.2 Lib Dem 16.7 0.0 83.3 42.6
30 E09000030 E09000030 Tower Hamlets Inner London 297,805 120,576 1,978.1 149.8 31 20 94 6 -875 8467 3518 37.8 Bangladesh 15.3 India 1.5 China 1.4 54.0 34.2 18,882 90 Italy Spain France 70 80.3 59.6 9.2 7.3 3.4 9.4 15.4 10.0 45.7 £34,849 . £32,934 £45,720 21 280,100 16 1 16,545 69 99.9 3.5 11.8 383,000 1181 920 7.0 19.8 41.6 31.5 15.2 1,948.3 28.1 43,589 0 19.3 5.0 59.2 44 73.8 25 78.1 82.5 18.1 7 7 7 3 26.7 7 238.7 Tower Hamlets First 11.1 48.9 0.0 47.2
31 E09000031 E09000031 Waltham Forest Outer London 274,139 104,777 3,880.8 71.1 35 22 90 10 -6052 5075 3194 36.0 Pakistan 4.9 Poland 3.2 Romania 1.7 49.9 26.4 17,257 95 Romania Bulgaria Poland 73 76.8 69.4 5.4 8.0 3.0 8.9 15.5 11.6 42.6 £29,532 £32,492 £25,729 £39,460 19 84,500 23 0 9,875 71 78.0 2.2 11.7 320,000 1447 670 20.6 29.2 19.9 30.0 31.4 850.5 35.5 76,217 1 12.8 3.6 58.3 42 51.4 18 79.4 83.8 26.2 7 8 7 3 21.7 6 185.3 Lab 26.7 73.3 0.0 37.6
32 E09000032 E09000032 Wandsworth Inner London 318,253 136,572 3,426.4 93.8 35 17 91 9 -2143 -241 3727 32.8 Poland 2.2 South Africa 2.1 Ireland 1.9 29.7 17.4 10,453 46 Italy Spain Poland 79 86.6 71.6 5.7 3.1 2.9 6.5 11.4 4.3 66.4 £39,562 £42,181 £37,053 £66,220 35 134,100 21 1 17,445 75 72.6 1.8 10.1 532,500 683 1,080 17.7 30.5 19.3 31.2 26.9 1,162.6 20.7 89,513 1 18.2 4.3 63.0 37 45.5 14 79.5 83.7 19.3 7 8 7 4 20.7 4 176.6 Cons 68.3 31.7 0.0 36.9
33 E09000033 E09000033 Westminster Inner London 239,862 117,509 2,148.7 110.4 38 15 88 12 -4000 8886 1567 51.3 United States 3.6 France 2.6 Iraq 2.1 38.8 30.8 13,380 79 Italy France Spain 66 68.6 62.3 8.8 3.4 2.2 8.4 17.5 4.5 63.6 £42,798 £45,872 £37,918 £80,760 24 730,700 13 4 53,160 64 212.4 4.0 19.9 875,000 674 750 17.1 11.6 27.8 43.3 38.2 3,048.4 19.1 48,810 0 18.4 6.5 65.7 44 66.8 18 82.3 86.3 15.4 7 7 7 3 24.5 4 161.5 Cons 73.3 26.7 0.0 32.3
34 #1 E13000001 Inner London NaN 3,494,269 1,467,652 31,929.2 109.2 34 18 91 9 -34970 58366 36493 39.9 Bangladesh 2.5 India 1.8 Ireland 1.7 43.1 25.2 169,187 69 Italy Romania Spain 72 78.0 66.6 6.4 5.7 3.3 9.6 15.6 7.2 57.0 . . . £56,890 . 3,442,500 14 1 265,230 69 106.4 2.6 13.1 465,000 1096 13,720 14.6 22.2 32.1 30.9 21.7 19,229.8 . 725,356 0 17.5 4.9 . 60 53.1 20 . . 23.1 7 8 7 3 - 5 . . 23.4 69.7 3.8 37.7
35 #2 E13000002 Outer London NaN 5,256,484 2,029,848 125,423.6 42.0 37 21 87 13 -33664 49038 45865 34.5 India 4.1 Poland 2.1 Pakistan 1.6 42.1 20.1 165,223 49 Romania Poland Italy 73 80.3 66.4 5.9 4.9 3.4 7.8 16.4 7.3 44.7 . . . £48,530 . 2,190,400 17 1 235,595 73 69.4 2.1 11.8 318,000 1425 13,140 27.3 32.0 16.7 23.9 42.5 21,929.8 . 1,939,058 1 12.7 3.0 . 47 40.8 15 . . 20.7 7 8 7 3 - 6 . . 39.2 49.4 7.8 39.6
36 #3 E12000007 London NaN 8,750,753 3,549,483 157,214.7 55.7 36 20 88 12 -68634 107404 82358 36.6 India 3.2 Poland 1.9 Ireland 1.6 42.5 22.1 334,419 57 Romania Italy Spain 73 79.3 66.5 6.1 5.2 3.4 8.5 16.1 7.3 49.9 £33,203 £35,622 £30,505 £51,770 26 5,633,400 15 1 500,825 71 84.0 2.3 12.3 365,000 1299 26,840 22.0 27.9 23.1 26.8 38.3 41,159.7 33.1 2,664,414 1 14.2 3.8 61.8 52 44.9 17 80.3 84.2 21.5 7 8 7 3 22.6 6 169.5 . 33.1 57.3 6.3 38.9
37 #4 E92000001 England NaN 54,316,618 23,171,399 13,025,966.7 . 40 19 32 18 -8902 249458 212855 14.2 India 1.3 Poland 1.1 Pakistan 0.9 . 8.0 749,198 22 Romania Poland Italy 74 79.1 68.6 5.1 5.1 4.7 9.2 19.2 8.4 36.7 £27,869 £30,165 £24,292 £30,763 24 28,556,100 17 1 2,235,345 74 65.7 . . 198,000 1484 170,690 32.1 31.8 17.5 18.5 87.5 361,360.1 43.7 25,696,833 1 15.0 . 56.8 60 17.4 16 79.5 83.2 22.8 7 8 7 3 19.1 6 182.7 . . . . .
38 #5 K02000001 United Kingdom NaN 64,596,752 . . . 40 19 32 18 . . . 13.0 . . . . . . . . 820,603 20 Romania Poland Italy 74 78.5 68.5 5.3 5.2 . . 19.5 8.8 36.9 £27,645 £29,934 £24,202 £39,430 . . 18 1 2,550,890 74 . . . 195,000 . . 32.3 31.8 17.9 17.9 . 445,928.8 . 30,333,100 1 . . . . . 16 . . . 7 8 7 3 NaN nan . . . . . .
39 NaN NaN National comparator NaN 54,316,618 23,171,399 13,025,966.7 . 40 19 32 18 -8902 249458 212855 13.0 India 1.3 Poland 1.1 Pakistan 0.9 . 8.0 820,603 20 Romania Poland Italy 74 79.1 68.6 5.1 . 4.7 . 19.2 8.8 36.9 £27,869 £30,165 £24,292 £39,430 24 28,556,100 17 1 2,235,345 74 65.7 NaN NaN 198,000 1484 170,690 32.3 31.8 17.9 17.9 87.5 445,928.8 43.7 25,696,833 1 15.0 . 56.8 60.0 17.4 16 79.5 83.2 22.8 8 8 7 3 19.1 6 182.7 . . . . .
In [140]:
# Delete row with label 0 
df1 = df1.drop([0], axis=0)
In [141]:
# Delete row with label 34, 35, 36, 37, 38, 39 
df1 = df1.drop([34, 35, 36, 37, 38, 39], axis=0)
In [142]:
df1.shape
Out[142]:
(33, 85)
In [143]:
df1
Out[143]:
Code New code Area name Inner/ Outer London GLA Population Estimate 2016 GLA Household Estimate 2016 Inland Area (Hectares) Population density (per hectare) 2016 Average Age, 2016 Proportion of population aged 0-15, 2016 Proportion of population of working-age, 2016 Proportion of population aged 65 and over, 2016 Net internal migration (2014) Net international migration (2014) Net natural change (2014) % of resident population born abroad (2014) Largest migrant population by country of birth (2011) % of largest migrant population (2011) Second largest migrant population by country of birth (2011) % of second largest migrant population (2011) Third largest migrant population by country of birth (2011) % of third largest migrant population (2011) % of population from BAME groups (2016) % people aged 3+ whose main language is not English (2011 Census) Overseas nationals entering the UK (NINo), (2014/15) New migrant (NINo) rates, (2014/15) Largest migrant population arrived during 2014/15 Second largest migrant population arrived during 2014/15 Third largest migrant population arrived during 2014/15 Employment rate (%) (2015) Male employment rate (2015) Female employment rate (2015) Unemployment rate (2015) Youth Unemployment (claimant) rate 18-24 (Dec-14) Proportion of 16-18 year olds who are NEET (%) (2014) Proportion of the working-age population who claim out-of-work benefits (%) (Aug-2015) % working-age with a disability (2015) Proportion of working age people with no qualifications (%) 2015 Proportion of working age with degree or equivalent and above (%) 2015 Gross Annual Pay, (2015) Gross Annual Pay - Male (2015) Gross Annual Pay - Female (2015) Modelled Household median income estimates 2012/13 % adults that volunteered in past 12 months (2010/11 to 2012/13) Number of jobs by workplace (2014) % of employment that is in public sector (2014) Jobs Density, 2014 Number of active businesses, 2014 Two-year business survival rates (started in 2012) Crime rates per thousand population 2014/15 Fires per thousand population (2014) Ambulance incidents per hundred population (2014) Median House Price, 2014 Average Band D Council Tax charge (£), 2015/16 New Homes (net) 2014/15 (provisional) Homes Owned outright, (2014) % Being bought with mortgage or loan, (2014) % Rented from Local Authority or Housing Association, (2014) % Rented from Private landlord, (2014) % % of area that is Greenspace, 2005 Total carbon emissions (2013) Household Waste Recycling Rate, 2014/15 Number of cars, (2011 Census) Number of cars per household, (2011 Census) % of adults who cycle at least once per month, 2013/14 Average Public Transport Accessibility score, 2014 Achievement of 5 or more A*- C grades at GCSE or equivalent including English and Maths, 2013/14 Rates of Children Looked After (2015) % of pupils whose first language is not English (2015) % children living in out-of-work households (2014) Male life expectancy, (2012-14) Female life expectancy, (2012-14) Teenage conception rate (2014) Life satisfaction score 2011-14 (out of 10) Worthwhileness score 2011-14 (out of 10) Happiness score 2011-14 (out of 10) Anxiety score 2011-14 (out of 10) Childhood Obesity Prevalance (%) 2014/15 People aged 17+ with diabetes (%) Mortality rate from causes considered preventable 2012/14 Political control in council Proportion of seats won by Conservatives in 2014 election Proportion of seats won by Labour in 2014 election Proportion of seats won by Lib Dems in 2014 election Turnout at 2014 local elections
1 E09000001 E09000001 City of London Inner London 8,548 5,179 290.4 28.9 43 27 91 9 138 252 35 . United States 2.8 France 2.0 Australia 1.9 27.5 17.1 892 151 France United States India 65 . . . 1.2 . 3.8 . . . . . . £99,390 . 500,400 3 85 19,250 63 . 12.3 . 765,000 943 230 . . . . 4.8 1,417.5 34.4 1,692 0 . 7.9 78.6 84 . 9 . . . 7 7 6 6 NaN 3 128.8 . . . . .
2 E09000002 E09000002 Barking and Dagenham Outer London 205,773 76,841 3,610.8 57.3 33 21 86 14 -1118 2543 2509 37.4 Nigeria 4.7 India 2.3 Pakistan 2.3 49.5 18.7 7,727 62 Romania Bulgaria Lithuania 66 75.6 56.5 11.0 7.3 5.7 11.7 17.2 11.3 32.2 £28,428 £29,792 £25,251 £34,080 21 58,900 21 0 5,690 73 83.4 3.0 13.7 215,000 1332 510 16.4 27.4 35.9 20.3 33.6 783.2 23.4 56,966 1 6.5 3.0 58.0 77 47.2 22 77.6 82.1 32.4 7 8 7 3 25.3 7 227.6 Lab 0.0 100.0 0.0 36.5
3 E09000003 E09000003 Barnet Outer London 385,108 149,147 8,674.8 44.5 37 21 83 17 -1884 4770 2938 35.9 India 3.1 Poland 2.4 Iran 2.0 38.7 23.4 14,412 59 Romania Poland Italy 68 74.5 62.9 8.5 3.5 2.5 6.7 14.9 5.2 49.0 £33,084 £37,058 £30,449 £54,530 33 167,300 19 1 24,555 70 62.7 1.6 11.1 400,000 1397 1,320 32.4 25.2 11.1 31.1 41.3 1,552.7 38.0 144,717 1 12.1 3.0 67.3 34 43.4 11 82.1 85.1 12.8 7 8 7 3 18.4 6 133.8 Cons 50.8 47.6 1.6 40.5
4 E09000004 E09000004 Bexley Outer London 243,303 97,233 6,058.1 39.9 39 21 89 11 1273 699 1195 16.1 Nigeria 2.6 India 1.5 Ireland 0.9 21.4 6.0 2,108 14 Romania Nigeria Poland 75 82.1 68.5 7.6 3.8 3.4 7.3 15.9 10.8 33.5 £32,040 £36,020 £25,776 £44,430 22 80,700 16 1 8,430 75 51.8 2.3 11.8 250,000 1446 810 38.1 35.3 15.2 11.4 31.7 1,060.9 54.0 108,507 1 9.2 2.6 60.3 50 15.0 15 80.4 84.4 19.5 7 8 7 3 21.4 7 164.3 Cons 71.4 23.8 0.0 39.6
5 E09000005 E09000005 Brent Outer London 328,568 119,166 4,323.3 76.1 36 20 82 18 -6932 6717 3694 56.2 India 9.2 Poland 3.4 Ireland 2.9 64.9 37.2 25,130 115 Romania Italy Portugal 70 76.0 62.6 7.5 6.1 2.6 9.0 17.7 6.2 45.1 £29,777 £31,149 £27,653 £39,630 17 133,600 18 1 14,680 70 78.8 1.8 12.1 385,000 1354 1,560 22.2 22.6 20.4 34.8 21.9 1,292.6 35.2 87,802 1 11.7 3.7 60.1 44 62.7 16 80.1 85.1 18.5 7 7 7 3 23.9 8 169.4 Lab 9.5 88.9 1.6 36.3
6 E09000006 E09000006 Bromley Outer London 326,560 139,654 15,013.5 21.7 40 16 88 12 1169 728 1486 17.2 India 1.1 Ireland 1.1 Nigeria 0.7 18.9 5.8 2,778 14 Romania Italy Poland 75 80.4 70.4 5.3 3.5 4.3 6.4 15.9 4.3 46.7 £36,498 £42,464 £32,600 £55,140 29 127,800 14 1 14,825 77 64.1 2.3 11.2 335,000 1325 410 37.8 34.9 13.2 14.1 57.8 1,334.7 48.0 153,908 1 12.2 2.8 68.0 37 10.8 12 81.4 84.9 16.7 8 8 7 3 16.5 5 148.5 Cons 85.0 11.7 0.0 40.8
7 E09000007 E09000007 Camden Inner London 240,595 106,518 2,178.9 109.8 36 9 83 17 -2790 6288 1642 42.4 United States 2.8 Bangladesh 2.7 Ireland 2.4 34.6 23.5 10,703 64 Italy France Spain 69 72.2 66.1 4.0 5.0 4.4 9.2 21.3 6.1 61.1 £39,610 £42,905 £35,936 £67,990 22 377,400 12 2 29,020 69 123.5 2.7 14.8 675,000 1337 440 18.5 15.1 34.4 32.0 24.8 1,540.5 26.3 46,601 0 15.1 5.7 62.7 43 55.4 19 81.8 86.7 16.8 7 7 7 4 20.8 4 163.8 Lab 22.2 74.1 1.9 38.7
8 E09000008 E09000008 Croydon Outer London 383,408 156,979 8,650.4 44.4 37 22 87 13 -2362 2189 3443 29.7 India 3.6 Jamaica 2.5 Ghana 1.5 49.9 14.5 7,902 32 Romania Poland Bulgaria 75 81.8 69.5 4.1 5.3 3.3 9.1 17.5 7.0 40.6 £32,887 £34,300 £30,509 £45,120 27 141,600 20 1 14,400 74 77.0 2.2 12.8 265,000 1466 1,520 30.8 33.6 16.7 18.6 37.1 1,452.2 39.9 140,049 1 6.8 3.2 57.7 87 30.2 16 80.3 83.6 28.4 7 8 7 3 23.8 6 178.2 Lab 42.9 57.1 0.0 38.6
9 E09000009 E09000009 Ealing Outer London 348,533 130,934 5,554.4 63.5 36 21 88 12 -6391 2291 3708 45.5 India 7.6 Poland 6.4 Ireland 2.3 53.5 33.9 15,143 66 Poland Romania Italy 73 81.2 63.8 5.8 5.2 3.0 8.6 15.2 9.1 49.7 £28,978 £30,800 £27,807 £45,690 32 160,500 14 1 17,475 74 75.5 1.9 11.3 388,000 1355 900 20.1 30.2 14.3 35.0 30.9 1,567.3 40.1 112,845 1 13.4 3.3 62.1 44 59.8 15 80.6 84.2 17.8 7 8 7 4 23.3 7 163.5 Lab 17.4 76.8 5.8 41.2
10 E09000010 E09000010 Enfield Outer London 330,968 129,014 8,083.2 41.0 36 23 87 13 -1892 2983 2948 32.8 Turkey 4.5 Cyprus (Not otherwise specified) 3.6 Poland 1.9 42.3 22.9 9,593 46 Romania Bulgaria Poland 73 80.4 66.0 3.8 7.3 3.1 10.1 18.4 4.5 43.4 £31,094 £34,234 £27,901 £41,250 22 128,800 22 1 13,015 74 69.4 2.2 12.2 285,000 1395 400 25.6 36.2 17.2 21.0 45.6 1,397.5 38.5 119,653 1 7.9 3.0 59.9 44 46.3 20 80.7 84.1 24.6 7 8 7 3 25.4 7 152.0 Lab 34.9 65.1 0.0 38.2
11 E09000011 E09000011 Greenwich Outer London 275,868 111,783 4,733.4 58.8 35 22 89 11 -1262 2793 2895 32.9 Nigeria 5.1 Nepal 1.9 India 1.7 40.3 16.9 7,184 40 Romania Nigeria Bulgaria 72 77.9 66.3 8.1 6.2 5.0 10.4 20.2 10.6 42.2 £31,757 £34,835 £28,911 £44,370 17 94,700 27 1 8,975 71 79.4 2.5 11.9 317,000 1276 1,150 19.2 26.9 34.2 19.7 34.4 1,004.5 34.3 78,185 1 11.6 3.4 58.8 80 38.7 19 79.0 82.5 28.1 7 8 7 3 24.5 6 193.2 Lab 15.7 84.3 0.0 37.3
12 E09000012 E09000012 Hackney Inner London 270,912 113,537 1,904.9 141.1 33 20 93 7 -226 2592 3405 38.9 Turkey 3.6 Nigeria 2.7 Jamaica 1.8 43.6 24.1 9,424 50 Italy Spain France 69 72.8 65.3 5.9 6.3 3.0 11.7 17.9 10.8 49.2 £32,199 . £32,205 £42,690 30 132,800 18 1 16,095 74 99.6 2.7 11.5 433,000 1293 1,260 11.1 19.8 45.4 23.3 23.2 877.8 25.3 41,800 0 24.1 4.9 60.6 58 50.8 22 78.5 83.3 24.7 7 7 7 4 25.6 6 210.6 Lab 7.0 87.7 5.3 39.4
13 E09000013 E09000013 Hammersmith and Fulham Inner London 183,354 82,513 1,639.7 111.8 36 17 90 10 -3248 1277 1681 41.5 France 2.7 Ireland 2.7 Australia 2.5 33.7 22.7 10,114 78 Italy Spain France 78 80.9 74.2 4.7 3.6 2.5 9.0 12.9 4.9 67.5 £38,029 . £34,539 £62,910 30 149,500 16 1 13,465 69 113.2 2.0 12.2 661,000 1023 1,360 19.1 21.8 25.9 33.1 19.1 971.3 20.7 43,843 0 24.0 4.7 60.5 55 45.8 18 79.7 84.1 22.4 7 8 7 3 23.3 4 187.4 Lab 43.5 56.5 0.0 37.6
14 E09000014 E09000014 Haringey Inner London 274,803 113,582 2,959.8 92.7 35 20 91 9 -4412 5559 3006 39.6 Poland 4.3 Turkey 4.0 Jamaica 2.0 38.2 29.7 17,549 93 Romania Bulgaria Italy 71 77.6 64.8 5.7 7.1 3.5 10.6 16.3 8.8 49.2 £30,931 £32,000 £29,224 £45,860 30 91,500 18 0 11,875 71 90.2 2.1 12.3 405,000 1479 130 18.0 24.7 33.4 23.9 25.5 891.6 37.3 61,515 1 15.2 4.3 59.7 75 52.3 20 80.1 84.9 22.6 7 8 7 3 22.6 6 183.4 Lab 0.0 84.2 15.8 38.1
15 E09000015 E09000015 Harrow Outer London 250,703 91,390 5,046.3 49.8 38 21 85 15 -2606 3030 2182 50.7 India 9.0 Kenya 4.9 Sri Lanka 4.3 61.8 28.5 11,239 71 Romania Poland India 74 83.1 64.7 4.6 4.3 1.5 6.0 13.9 4.2 47.9 £32,529 £36,355 £29,621 £49,060 39 88,600 14 1 14,000 75 50.4 1.3 9.8 370,000 1529 410 33.5 32.8 8.9 24.6 34.6 837.7 45.1 100,326 1 5.1 2.9 66.4 29 61.6 10 82.7 86.1 11.0 7 7 7 3 21.1 8 134.2 Lab 41.3 54.0 1.6 40.7
16 E09000016 E09000016 Havering Outer London 251,611 102,954 11,235.0 22.3 40 20 82 18 2244 673 977 11.9 Ireland 1.1 India 1.0 Nigeria 0.9 15.7 4.6 2,459 16 Romania Lithuania Bulgaria 76 81.3 71.8 5.3 3.8 4.0 7.5 18.2 10.5 26.0 £32,274 £36,530 £28,243 £44,430 17 91,300 21 1 9,445 77 62.9 2.5 12.9 250,000 1514 640 35.2 33.9 17.2 13.8 59.3 1,161.2 32.4 117,634 1 9.2 2.5 59.8 45 12.5 15 80.2 83.9 22.8 7 8 7 3 20.8 6 159.3 No Overall Control 40.7 1.9 0.0 43.1
17 E09000017 E09000017 Hillingdon Outer London 299,474 109,932 11,570.1 25.8 36 21 87 13 -800 3970 2636 33.1 India 5.7 Pakistan 1.8 Ireland 1.6 45.7 18.8 6,554 34 Romania India Poland 73 80.7 65.9 5.8 3.2 2.4 7.2 17.9 8.7 40.2 £32,989 £34,409 £30,515 £44,950 24 220,900 11 1 12,485 74 76.6 2.6 14.7 307,000 1408 550 22.2 33.0 16.6 28.2 49.2 1,998.4 43.8 122,486 1 13.3 2.4 62.0 48 42.8 14 80.4 83.9 20.5 7 8 7 3 19.8 6 170.1 Cons 64.6 35.4 0.0 36.1
18 E09000018 E09000018 Hounslow Outer London 272,102 104,474 5,597.8 48.9 36 21 89 11 -3678 3607 2990 47.8 India 10.7 Poland 4.1 Pakistan 2.8 51.6 28.7 11,132 62 Romania Poland India 74 84.7 63.2 4.3 4.9 3.2 7.5 17.6 6.5 45.5 . . . £44,490 27 165,700 12 1 13,035 74 79.2 2.1 12.1 319,950 1375 400 25.5 27.0 19.2 28.3 39.6 1,420.7 34.5 94,042 1 15.3 3.0 63.2 48 58.8 15 80.0 83.9 25.0 7 8 7 3 22.8 6 165.8 Lab 18.3 81.7 0.0 36.8
19 E09000019 E09000019 Islington Inner London 228,397 103,612 1,485.7 153.0 35 16 91 9 -1067 4620 1826 36.8 Ireland 2.8 Turkey 1.8 United States 1.5 32.0 19.9 9,435 57 Italy France Spain 73 78.2 67.0 4.5 6.5 5.2 11.6 14.6 6.2 62.7 £35,476 £39,361 £31,994 £54,950 31 231,500 14 1 18,710 69 121.2 2.6 13.9 530,000 1276 500 15.4 23.5 35.3 25.5 12.4 1,052.1 32.8 38,629 0 21.0 5.7 59.9 90 45.2 26 79.0 83.5 20.2 7 7 7 4 22.8 5 202.8 Lab 0.0 97.9 0.0 38.4
20 E09000020 E09000020 Kensington and Chelsea Inner London 158,447 79,735 1,212.4 129.2 39 16 86 14 -1580 1059 1088 54.7 United States 5.0 France 4.2 Italy 2.7 30.0 28.0 7,676 70 Italy France Spain 68 76.3 60.4 4.2 4.5 3.6 7.8 14.3 5.2 65.2 . . . £116,350 31 143,500 15 1 13,635 69 120.9 2.0 12.7 1,195,000 1078 980 22.6 15.1 29.1 33.1 15.1 1,236.0 25.3 44,536 1 16.2 5.8 68.7 38 51.7 12 83.3 86.4 14.2 8 8 8 3 21.5 4 136.3 Cons 74.0 24.0 2.0 29.8
21 E09000021 E09000021 Kingston upon Thames Outer London 173,853 69,132 3,726.1 46.3 37 19 87 13 -188 2136 1178 29.2 Sri Lanka 2.2 India 1.8 Korea (South) 1.4 30.4 16.4 3,157 28 Bulgaria Poland Romania 74 80.9 67.8 4.5 2.8 3.9 5.1 15.3 5.9 53.7 £36,767 £40,000 £32,928 £56,920 43 83,700 17 1 8,520 79 58.5 1.8 11.1 385,000 1675 530 27.7 38.9 10.7 22.4 36.4 752.4 45.7 70,421 1 21.1 2.9 68.6 32 32.6 9 82.0 84.6 15.3 7 8 7 3 15.8 5 140.6 Cons 58.3 4.2 37.5 43.1
22 E09000022 E09000022 Lambeth Inner London 325,455 142,382 2,681.0 121.4 34 18 92 8 -1908 2645 3230 33.6 Jamaica 3.2 Portugal 2.3 Poland 2.3 41.5 20.3 12,764 54 Spain Italy Portugal 78 82.3 74.6 5.9 5.2 2.2 9.8 16.1 6.2 65.0 £33,341 . £30,732 £48,610 32 184,000 23 1 20,900 68 104.6 2.5 13.3 420,000 1239 1,410 10.9 24.9 29.8 34.4 17.3 1,257.3 28.3 66,791 0 20.2 5.0 57.1 78 47.1 22 78.9 83.3 33.8 7 7 7 4 27.1 5 205.0 Lab 4.8 93.7 0.0 34.5
23 E09000023 E09000023 Lewisham Inner London 299,817 128,966 3,514.9 84.7 35 21 91 9 -787 3234 3292 30.9 Jamaica 3.5 Nigeria 3.5 Poland 1.6 47.4 16.5 8,482 42 Romania Italy Spain 76 79.6 72.4 5.7 7.5 3.5 10.8 16.5 5.8 53.3 £31,783 £32,738 £30,048 £43,360 28 90,000 25 0 9,625 75 77.0 2.2 12.0 315,000 1355 1,470 16.5 31.7 28.1 23.6 22.5 930.3 17.1 76,507 1 13.1 4.1 56.3 73 30.7 21 79.0 83.4 31.3 7 8 7 3 24.2 6 190.8 Lab 0.0 98.1 0.0 37.2
24 E09000024 E09000024 Merton Outer London 207,141 83,446 3,762.5 55.7 37 20 88 12 -2365 540 2115 41.1 Poland 3.5 Sri Lanka 3.2 South Africa 2.8 36.7 21.1 6,730 49 Poland Romania Bulgaria 79 86.3 71.4 4.6 4.7 4.3 6.3 13.5 4.7 58.0 £33,122 £36,763 £30,307 £57,160 22 96,800 12 1 11,225 72 59.7 1.8 10.4 385,000 1401 430 21.7 32.7 16.2 29.3 34.6 844.6 37.5 72,777 1 19.4 3.4 67.8 34 41.9 12 80.4 84.2 19.7 7 8 7 4 21.6 6 161.8 Lab 33.3 60.0 1.7 41.3
25 E09000025 E09000025 Newham Inner London 337,378 116,187 3,619.8 93.5 32 22 93 7 -8534 9518 5092 51.8 India 8.7 Bangladesh 6.8 Pakistan 5.3 73.1 41.4 26,478 116 Romania Bulgaria India 66 75.0 56.1 9.1 7.0 4.3 9.2 12.7 11.0 43.4 £27,174 £28,160 £25,055 £34,260 8 111,100 23 0 9,645 68 90.8 2.5 12.2 250,000 1241 2,050 9.4 16.7 31.4 42.5 23.9 1,441.6 17.2 61,092 1 7.1 3.9 55.7 52 70.8 18 78.5 83.0 22.5 7 7 7 3 27.4 8 193.4 Lab 0.0 100.0 0.0 40.5
26 E09000026 E09000026 Redbridge Outer London 301,022 109,114 5,641.9 53.3 36 23 88 12 -1622 3403 3003 40.1 India 7.6 Pakistan 5.3 Sri Lanka 2.6 62.7 24.6 10,237 54 Romania India Italy 68 79.1 57.6 7.9 5.4 3.3 6.6 17.1 10.2 44.7 £35,665 £39,266 £30,118 £45,380 25 90,700 23 0 13,160 71 69.7 1.9 11.3 301,500 1391 260 29.5 34.9 11.3 24.1 40.6 963.5 28.7 106,339 1 9.5 3.0 68.7 29 61.1 12 80.9 84.6 18.5 7 8 7 3 22.9 8 141.9 Lab 39.7 55.6 4.8 39.7
27 E09000027 E09000027 Richmond upon Thames Outer London 196,602 84,615 5,740.7 34.3 39 20 85 15 208 426 1610 24.2 Ireland 1.8 South Africa 1.4 United States 1.4 15.7 10.4 2,536 20 Poland Italy Spain 80 82.1 77.2 3.8 2.9 4.3 4.7 10.8 3.2 69.5 £39,563 £42,896 £34,653 £76,610 49 95,900 11 1 13,650 76 56.3 1.5 9.7 535,000 1582 240 30.9 38.4 8.7 21.9 50.8 880.9 41.2 84,918 1 31.7 3.1 70.5 22 20.9 6 82.4 86.0 12.6 8 8 7 3 11.2 4 137.4 Cons 72.2 0.0 27.8 46.1
28 E09000028 E09000028 Southwark Inner London 310,642 132,080 2,886.2 108.2 34 18 92 8 -3538 4210 3384 35.9 Nigeria 4.7 Jamaica 2.0 Ireland 1.7 45.7 19.6 12,955 58 Spain Italy Romania 74 79.8 68.6 7.7 6.2 2.0 10.2 16.8 7.6 56.8 £34,537 £36,067 £32,600 £48,000 26 285,900 19 1 15,860 71 100.6 3.0 13.6 420,000 1207 1,140 10.1 26.3 37.2 26.4 24.9 1,454.5 34.6 60,438 0 15.6 4.9 61.2 82 41.9 22 78.9 83.9 27.4 7 8 7 3 28.0 6 207.5 Lab 3.2 76.2 20.6 36.2
29 E09000029 E09000029 Sutton Outer London 201,751 84,612 4,384.7 46.1 39 21 85 15 594 465 1164 26.4 Sri Lanka 1.8 India 1.7 Ireland 1.2 25.0 10.0 1,945 15 Romania Bulgaria Poland 78 86.2 70.5 5.5 3.4 3.2 6.2 14.4 4.3 42.5 £31,387 £36,168 £26,404 £49,170 24 78,600 19 1 8,155 77 55.9 2.0 11.3 285,000 1459 430 25.7 41.8 11.6 20.5 32.0 774.4 37.6 91,266 1 12.5 2.9 67.4 50 22.9 12 80.9 83.4 17.3 7 8 7 3 17.4 6 163.2 Lib Dem 16.7 0.0 83.3 42.6
30 E09000030 E09000030 Tower Hamlets Inner London 297,805 120,576 1,978.1 149.8 31 20 94 6 -875 8467 3518 37.8 Bangladesh 15.3 India 1.5 China 1.4 54.0 34.2 18,882 90 Italy Spain France 70 80.3 59.6 9.2 7.3 3.4 9.4 15.4 10.0 45.7 £34,849 . £32,934 £45,720 21 280,100 16 1 16,545 69 99.9 3.5 11.8 383,000 1181 920 7.0 19.8 41.6 31.5 15.2 1,948.3 28.1 43,589 0 19.3 5.0 59.2 44 73.8 25 78.1 82.5 18.1 7 7 7 3 26.7 7 238.7 Tower Hamlets First 11.1 48.9 0.0 47.2
31 E09000031 E09000031 Waltham Forest Outer London 274,139 104,777 3,880.8 71.1 35 22 90 10 -6052 5075 3194 36.0 Pakistan 4.9 Poland 3.2 Romania 1.7 49.9 26.4 17,257 95 Romania Bulgaria Poland 73 76.8 69.4 5.4 8.0 3.0 8.9 15.5 11.6 42.6 £29,532 £32,492 £25,729 £39,460 19 84,500 23 0 9,875 71 78.0 2.2 11.7 320,000 1447 670 20.6 29.2 19.9 30.0 31.4 850.5 35.5 76,217 1 12.8 3.6 58.3 42 51.4 18 79.4 83.8 26.2 7 8 7 3 21.7 6 185.3 Lab 26.7 73.3 0.0 37.6
32 E09000032 E09000032 Wandsworth Inner London 318,253 136,572 3,426.4 93.8 35 17 91 9 -2143 -241 3727 32.8 Poland 2.2 South Africa 2.1 Ireland 1.9 29.7 17.4 10,453 46 Italy Spain Poland 79 86.6 71.6 5.7 3.1 2.9 6.5 11.4 4.3 66.4 £39,562 £42,181 £37,053 £66,220 35 134,100 21 1 17,445 75 72.6 1.8 10.1 532,500 683 1,080 17.7 30.5 19.3 31.2 26.9 1,162.6 20.7 89,513 1 18.2 4.3 63.0 37 45.5 14 79.5 83.7 19.3 7 8 7 4 20.7 4 176.6 Cons 68.3 31.7 0.0 36.9
33 E09000033 E09000033 Westminster Inner London 239,862 117,509 2,148.7 110.4 38 15 88 12 -4000 8886 1567 51.3 United States 3.6 France 2.6 Iraq 2.1 38.8 30.8 13,380 79 Italy France Spain 66 68.6 62.3 8.8 3.4 2.2 8.4 17.5 4.5 63.6 £42,798 £45,872 £37,918 £80,760 24 730,700 13 4 53,160 64 212.4 4.0 19.9 875,000 674 750 17.1 11.6 27.8 43.3 38.2 3,048.4 19.1 48,810 0 18.4 6.5 65.7 44 66.8 18 82.3 86.3 15.4 7 7 7 3 24.5 4 161.5 Cons 73.3 26.7 0.0 32.3
In [144]:
# Create a new df of just the columns that we need
df1 = df1.iloc[:, [2, 4, 6, 7, 8, 29, 39, 49, 52, 59]]
In [145]:
df1.shape
Out[145]:
(33, 10)
In [146]:
df1
Out[146]:
Area name GLA Population Estimate 2016 Inland Area (Hectares) Population density (per hectare) 2016 Average Age, 2016 Employment rate (%) (2015) Gross Annual Pay, (2015) Crime rates per thousand population 2014/15 Median House Price, 2014 % of area that is Greenspace, 2005
1 City of London 8,548 290.4 28.9 43 65 . . 765,000 4.8
2 Barking and Dagenham 205,773 3,610.8 57.3 33 66 £28,428 83.4 215,000 33.6
3 Barnet 385,108 8,674.8 44.5 37 68 £33,084 62.7 400,000 41.3
4 Bexley 243,303 6,058.1 39.9 39 75 £32,040 51.8 250,000 31.7
5 Brent 328,568 4,323.3 76.1 36 70 £29,777 78.8 385,000 21.9
6 Bromley 326,560 15,013.5 21.7 40 75 £36,498 64.1 335,000 57.8
7 Camden 240,595 2,178.9 109.8 36 69 £39,610 123.5 675,000 24.8
8 Croydon 383,408 8,650.4 44.4 37 75 £32,887 77.0 265,000 37.1
9 Ealing 348,533 5,554.4 63.5 36 73 £28,978 75.5 388,000 30.9
10 Enfield 330,968 8,083.2 41.0 36 73 £31,094 69.4 285,000 45.6
11 Greenwich 275,868 4,733.4 58.8 35 72 £31,757 79.4 317,000 34.4
12 Hackney 270,912 1,904.9 141.1 33 69 £32,199 99.6 433,000 23.2
13 Hammersmith and Fulham 183,354 1,639.7 111.8 36 78 £38,029 113.2 661,000 19.1
14 Haringey 274,803 2,959.8 92.7 35 71 £30,931 90.2 405,000 25.5
15 Harrow 250,703 5,046.3 49.8 38 74 £32,529 50.4 370,000 34.6
16 Havering 251,611 11,235.0 22.3 40 76 £32,274 62.9 250,000 59.3
17 Hillingdon 299,474 11,570.1 25.8 36 73 £32,989 76.6 307,000 49.2
18 Hounslow 272,102 5,597.8 48.9 36 74 . 79.2 319,950 39.6
19 Islington 228,397 1,485.7 153.0 35 73 £35,476 121.2 530,000 12.4
20 Kensington and Chelsea 158,447 1,212.4 129.2 39 68 . 120.9 1,195,000 15.1
21 Kingston upon Thames 173,853 3,726.1 46.3 37 74 £36,767 58.5 385,000 36.4
22 Lambeth 325,455 2,681.0 121.4 34 78 £33,341 104.6 420,000 17.3
23 Lewisham 299,817 3,514.9 84.7 35 76 £31,783 77.0 315,000 22.5
24 Merton 207,141 3,762.5 55.7 37 79 £33,122 59.7 385,000 34.6
25 Newham 337,378 3,619.8 93.5 32 66 £27,174 90.8 250,000 23.9
26 Redbridge 301,022 5,641.9 53.3 36 68 £35,665 69.7 301,500 40.6
27 Richmond upon Thames 196,602 5,740.7 34.3 39 80 £39,563 56.3 535,000 50.8
28 Southwark 310,642 2,886.2 108.2 34 74 £34,537 100.6 420,000 24.9
29 Sutton 201,751 4,384.7 46.1 39 78 £31,387 55.9 285,000 32.0
30 Tower Hamlets 297,805 1,978.1 149.8 31 70 £34,849 99.9 383,000 15.2
31 Waltham Forest 274,139 3,880.8 71.1 35 73 £29,532 78.0 320,000 31.4
32 Wandsworth 318,253 3,426.4 93.8 35 79 £39,562 72.6 532,500 26.9
33 Westminster 239,862 2,148.7 110.4 38 66 £42,798 212.4 875,000 38.2
In [147]:
# Rename a column in the df. Foursquare label their borough - neighborhoods
df1 = df1.rename(columns={"Area name": "Borough"})
In [148]:
df1.to_csv('Capstone Project.csv')
In [149]:
df1.head(5)
Out[149]:
Borough GLA Population Estimate 2016 Inland Area (Hectares) Population density (per hectare) 2016 Average Age, 2016 Employment rate (%) (2015) Gross Annual Pay, (2015) Crime rates per thousand population 2014/15 Median House Price, 2014 % of area that is Greenspace, 2005
1 City of London 8,548 290.4 28.9 43 65 . . 765,000 4.8
2 Barking and Dagenham 205,773 3,610.8 57.3 33 66 £28,428 83.4 215,000 33.6
3 Barnet 385,108 8,674.8 44.5 37 68 £33,084 62.7 400,000 41.3
4 Bexley 243,303 6,058.1 39.9 39 75 £32,040 51.8 250,000 31.7
5 Brent 328,568 4,323.3 76.1 36 70 £29,777 78.8 385,000 21.9
In [150]:
# Strip unwanted text from df
df1['Gross Annual Pay, (2015)'] = df1['Gross Annual Pay, (2015)'].str.replace(',','')
df1['Gross Annual Pay, (2015)'] = df1['Gross Annual Pay, (2015)'].str.replace('£','')
df1['Gross Annual Pay, (2015)'] = df1['Gross Annual Pay, (2015)'].str.replace('.','')
df1['Crime rates per thousand population 2014/15'] = df1['Crime rates per thousand population 2014/15'].str.replace('.','')
df1['Median House Price, 2014'] = df1['Median House Price, 2014'].str.replace(',','')
df1
Out[150]:
Borough GLA Population Estimate 2016 Inland Area (Hectares) Population density (per hectare) 2016 Average Age, 2016 Employment rate (%) (2015) Gross Annual Pay, (2015) Crime rates per thousand population 2014/15 Median House Price, 2014 % of area that is Greenspace, 2005
1 City of London 8,548 290.4 28.9 43 65 765000 4.8
2 Barking and Dagenham 205,773 3,610.8 57.3 33 66 28428 834 215000 33.6
3 Barnet 385,108 8,674.8 44.5 37 68 33084 627 400000 41.3
4 Bexley 243,303 6,058.1 39.9 39 75 32040 518 250000 31.7
5 Brent 328,568 4,323.3 76.1 36 70 29777 788 385000 21.9
6 Bromley 326,560 15,013.5 21.7 40 75 36498 641 335000 57.8
7 Camden 240,595 2,178.9 109.8 36 69 39610 1235 675000 24.8
8 Croydon 383,408 8,650.4 44.4 37 75 32887 770 265000 37.1
9 Ealing 348,533 5,554.4 63.5 36 73 28978 755 388000 30.9
10 Enfield 330,968 8,083.2 41.0 36 73 31094 694 285000 45.6
11 Greenwich 275,868 4,733.4 58.8 35 72 31757 794 317000 34.4
12 Hackney 270,912 1,904.9 141.1 33 69 32199 996 433000 23.2
13 Hammersmith and Fulham 183,354 1,639.7 111.8 36 78 38029 1132 661000 19.1
14 Haringey 274,803 2,959.8 92.7 35 71 30931 902 405000 25.5
15 Harrow 250,703 5,046.3 49.8 38 74 32529 504 370000 34.6
16 Havering 251,611 11,235.0 22.3 40 76 32274 629 250000 59.3
17 Hillingdon 299,474 11,570.1 25.8 36 73 32989 766 307000 49.2
18 Hounslow 272,102 5,597.8 48.9 36 74 792 319950 39.6
19 Islington 228,397 1,485.7 153.0 35 73 35476 1212 530000 12.4
20 Kensington and Chelsea 158,447 1,212.4 129.2 39 68 1209 1195000 15.1
21 Kingston upon Thames 173,853 3,726.1 46.3 37 74 36767 585 385000 36.4
22 Lambeth 325,455 2,681.0 121.4 34 78 33341 1046 420000 17.3
23 Lewisham 299,817 3,514.9 84.7 35 76 31783 770 315000 22.5
24 Merton 207,141 3,762.5 55.7 37 79 33122 597 385000 34.6
25 Newham 337,378 3,619.8 93.5 32 66 27174 908 250000 23.9
26 Redbridge 301,022 5,641.9 53.3 36 68 35665 697 301500 40.6
27 Richmond upon Thames 196,602 5,740.7 34.3 39 80 39563 563 535000 50.8
28 Southwark 310,642 2,886.2 108.2 34 74 34537 1006 420000 24.9
29 Sutton 201,751 4,384.7 46.1 39 78 31387 559 285000 32.0
30 Tower Hamlets 297,805 1,978.1 149.8 31 70 34849 999 383000 15.2
31 Waltham Forest 274,139 3,880.8 71.1 35 73 29532 780 320000 31.4
32 Wandsworth 318,253 3,426.4 93.8 35 79 39562 726 532500 26.9
33 Westminster 239,862 2,148.7 110.4 38 66 42798 2124 875000 38.2
In [151]:
df1.dtypes
Out[151]:
Borough                                         object
GLA Population Estimate 2016                    object
Inland Area (Hectares)                          object
Population density (per hectare) 2016           object
Average Age, 2016                              float64
Employment rate (%) (2015)                     float64
Gross Annual Pay, (2015)                        object
Crime rates per thousand population 2014/15     object
Median House Price, 2014                        object
% of area that is Greenspace, 2005              object
dtype: object
I wanted to convert the objects within the DF to numeric values but could not do it

dfl['Gross Annual Pay, (2015)'] = pd.to_numeric(dfl['Gross Annual Pay, (2015)'])

dfl['Crime rates per thousand population 2014/15'] = pd.to_numeric(dfl['Crime rates per thousand population 2014/15'])

dfl['Median House Price, 2014'] = pd.to_numeric(dfl['Median House Price, 2014'])

dfl['% of area that is Greenspace, 2005'] = pd.to_numeric(dfl['% of area that is Greenspace, 2005'])

df1.dtypes

Merge the two dataframes (dfld, df1)

In [152]:
ldn_merged = pd.merge(dfld, df1, on='Borough')
dfldn_merged = ldn_merged[['Borough','Population', 'Area','Population / Area','Average Age, 2016', 'Gross Annual Pay, (2015)', 'Crime rates per thousand population 2014/15','Median House Price, 2014','% of area that is Greenspace, 2005']]
dfldn_merged
Out[152]:
Borough Population Area Population / Area Average Age, 2016 Gross Annual Pay, (2015) Crime rates per thousand population 2014/15 Median House Price, 2014 % of area that is Greenspace, 2005
0 Islington 215667 6 37,573 35 35476 1212 530000 12.4
1 Tower Hamlets 272890 8 35,765 31 34849 999 383000 15.2
2 Hackney 257379 7 34,970 33 32199 996 433000 23.2
3 Kensington and Chelsea 155594 5 33,247 39 1209 1195000 15.1
4 Lambeth 314242 10 30,332 34 33341 1046 420000 17.3
5 Hammersmith and Fulham 178685 6 28,228 36 38029 1132 661000 19.1
6 Westminster 226841 8 27,363 38 42798 2124 875000 38.2
7 Camden 229719 8 27,348 36 39610 1235 675000 24.8
8 Southwark 298464 11 26,792 34 34537 1006 420000 24.9
9 Wandsworth 310516 13 23,471 35 39562 726 532500 26.9
10 Haringey 263386 11 23,064 35 30931 902 405000 25.5
11 Newham 318227 14 22,763 32 27174 908 250000 23.9
12 Lewisham 286180 14 21,089 35 31783 770 315000 22.5
13 Brent 317264 17 18,998 36 29777 788 385000 21.9
14 Waltham Forest 265797 15 17,732 35 29532 780 320000 31.4
15 Ealing 342494 21 15,975 36 28978 755 388000 30.9
16 Greenwich 264008 18 14,442 35 31757 794 317000 34.4
17 Merton 203223 15 13,996 37 33122 597 385000 34.6
18 Barking and Dagenham 194352 14 13,952 33 28428 834 215000 33.6
19 Redbridge 288272 22 13,236 36 35665 697 301500 40.6
20 Harrow 243372 19 12,487 38 32529 504 370000 34.6
21 Hounslow 262407 22 12,143 36 792 319950 39.6
22 Kingston upon Thames 166793 14 11,599 37 36767 585 385000 36.4
23 Sutton 195914 17 11,572 39 31387 559 285000 32.0
24 Croydon 372752 33 11,157 37 32887 770 265000 37.1
25 Barnet 369088 33 11,021 37 33084 627 400000 41.3
26 Bexley 236687 23 10,123 39 32040 518 250000 31.7
27 Enfield 320524 32 10,098 36 31094 694 285000 45.6
28 Richmond upon Thames 191365 22 8,632 39 39563 563 535000 50.8
29 Hillingdon 286806 45 6,421 36 32989 766 307000 49.2
30 City of London 7000 1 6,250 43 765000 4.8
31 Havering 242080 43 5,584 40 32274 629 250000 59.3
32 Bromley 317899 58 5,484 40 36498 641 335000 57.8
In [153]:
dfldn_merged.dtypes
Out[153]:
Borough                                         object
Population                                       int64
Area                                           float64
Population / Area                              float64
Average Age, 2016                              float64
Gross Annual Pay, (2015)                        object
Crime rates per thousand population 2014/15     object
Median House Price, 2014                        object
% of area that is Greenspace, 2005              object
dtype: object
In [154]:
dfldn_merged.rename(columns={'Average Age, 2016':'Average Age'}, inplace=True)
dfldn_merged.rename(columns={'Gross Annual Pay, (2015)':'Annual Pay'}, inplace=True)
dfldn_merged.rename(columns={'Crime rates per thousand population 2014/15':'Crime/1000'}, inplace=True)
dfldn_merged.rename(columns={'Median House Price, 2014':'House Price'}, inplace=True)
dfldn_merged.rename(columns={'% of area that is Greenspace, 2005':'%Greenspace'}, inplace=True)
dfldn_merged
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py:4133: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  errors=errors,
Out[154]:
Borough Population Area Population / Area Average Age Annual Pay Crime/1000 House Price %Greenspace
0 Islington 215667 6 37,573 35 35476 1212 530000 12.4
1 Tower Hamlets 272890 8 35,765 31 34849 999 383000 15.2
2 Hackney 257379 7 34,970 33 32199 996 433000 23.2
3 Kensington and Chelsea 155594 5 33,247 39 1209 1195000 15.1
4 Lambeth 314242 10 30,332 34 33341 1046 420000 17.3
5 Hammersmith and Fulham 178685 6 28,228 36 38029 1132 661000 19.1
6 Westminster 226841 8 27,363 38 42798 2124 875000 38.2
7 Camden 229719 8 27,348 36 39610 1235 675000 24.8
8 Southwark 298464 11 26,792 34 34537 1006 420000 24.9
9 Wandsworth 310516 13 23,471 35 39562 726 532500 26.9
10 Haringey 263386 11 23,064 35 30931 902 405000 25.5
11 Newham 318227 14 22,763 32 27174 908 250000 23.9
12 Lewisham 286180 14 21,089 35 31783 770 315000 22.5
13 Brent 317264 17 18,998 36 29777 788 385000 21.9
14 Waltham Forest 265797 15 17,732 35 29532 780 320000 31.4
15 Ealing 342494 21 15,975 36 28978 755 388000 30.9
16 Greenwich 264008 18 14,442 35 31757 794 317000 34.4
17 Merton 203223 15 13,996 37 33122 597 385000 34.6
18 Barking and Dagenham 194352 14 13,952 33 28428 834 215000 33.6
19 Redbridge 288272 22 13,236 36 35665 697 301500 40.6
20 Harrow 243372 19 12,487 38 32529 504 370000 34.6
21 Hounslow 262407 22 12,143 36 792 319950 39.6
22 Kingston upon Thames 166793 14 11,599 37 36767 585 385000 36.4
23 Sutton 195914 17 11,572 39 31387 559 285000 32.0
24 Croydon 372752 33 11,157 37 32887 770 265000 37.1
25 Barnet 369088 33 11,021 37 33084 627 400000 41.3
26 Bexley 236687 23 10,123 39 32040 518 250000 31.7
27 Enfield 320524 32 10,098 36 31094 694 285000 45.6
28 Richmond upon Thames 191365 22 8,632 39 39563 563 535000 50.8
29 Hillingdon 286806 45 6,421 36 32989 766 307000 49.2
30 City of London 7000 1 6,250 43 765000 4.8
31 Havering 242080 43 5,584 40 32274 629 250000 59.3
32 Bromley 317899 58 5,484 40 36498 641 335000 57.8
In [155]:
# Establish the best place to live in London by specific column heading
column_heading = 'House Price'
dfldn_merged.sort_values(by=column_heading, inplace=True, ascending=False)
dfldn_merged
/Users/renierswanepoel/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:3: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  This is separate from the ipykernel package so we can avoid doing imports until
Out[155]:
Borough Population Area Population / Area Average Age Annual Pay Crime/1000 House Price %Greenspace
6 Westminster 226841 8 27,363 38 42798 2124 875000 38.2
30 City of London 7000 1 6,250 43 765000 4.8
7 Camden 229719 8 27,348 36 39610 1235 675000 24.8
5 Hammersmith and Fulham 178685 6 28,228 36 38029 1132 661000 19.1
28 Richmond upon Thames 191365 22 8,632 39 39563 563 535000 50.8
9 Wandsworth 310516 13 23,471 35 39562 726 532500 26.9
0 Islington 215667 6 37,573 35 35476 1212 530000 12.4
2 Hackney 257379 7 34,970 33 32199 996 433000 23.2
4 Lambeth 314242 10 30,332 34 33341 1046 420000 17.3
8 Southwark 298464 11 26,792 34 34537 1006 420000 24.9
10 Haringey 263386 11 23,064 35 30931 902 405000 25.5
25 Barnet 369088 33 11,021 37 33084 627 400000 41.3
15 Ealing 342494 21 15,975 36 28978 755 388000 30.9
13 Brent 317264 17 18,998 36 29777 788 385000 21.9
22 Kingston upon Thames 166793 14 11,599 37 36767 585 385000 36.4
17 Merton 203223 15 13,996 37 33122 597 385000 34.6
1 Tower Hamlets 272890 8 35,765 31 34849 999 383000 15.2
20 Harrow 243372 19 12,487 38 32529 504 370000 34.6
32 Bromley 317899 58 5,484 40 36498 641 335000 57.8
14 Waltham Forest 265797 15 17,732 35 29532 780 320000 31.4
21 Hounslow 262407 22 12,143 36 792 319950 39.6
16 Greenwich 264008 18 14,442 35 31757 794 317000 34.4
12 Lewisham 286180 14 21,089 35 31783 770 315000 22.5
29 Hillingdon 286806 45 6,421 36 32989 766 307000 49.2
19 Redbridge 288272 22 13,236 36 35665 697 301500 40.6
23 Sutton 195914 17 11,572 39 31387 559 285000 32.0
27 Enfield 320524 32 10,098 36 31094 694 285000 45.6
24 Croydon 372752 33 11,157 37 32887 770 265000 37.1
26 Bexley 236687 23 10,123 39 32040 518 250000 31.7
11 Newham 318227 14 22,763 32 27174 908 250000 23.9
31 Havering 242080 43 5,584 40 32274 629 250000 59.3
18 Barking and Dagenham 194352 14 13,952 33 28428 834 215000 33.6
3 Kensington and Chelsea 155594 5 33,247 39 1209 1195000 15.1

More neighborhood analysis using Foursquare

In [156]:
# Define FourSquare credentials and version
CLIENT_ID = 'ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD' # your Foursquare ID
CLIENT_SECRET = '1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ' # your Foursquare Secret
VERSION = '20180604'
print('Your credentails:')
print('CLIENT_ID: ' + CLIENT_ID)
print('CLIENT_SECRET:' + CLIENT_SECRET)
Your credentails:
CLIENT_ID: ZAKTWFME55ES15RSKX5XZR11LAMYDRDQSKCGJK1W4HQO1DKD
CLIENT_SECRET:1BKCLDR54L3AG4FCSLODH3AH1GONHIAG3FFGOE0KCF3GFJHQ
In [157]:
# Create a London geolocator
address = 'London, UK'

geolocator = Nominatim(user_agent="foursquare_agent")
location = geolocator.geocode(address)
latitude = location.latitude
longitude = location.longitude
print(latitude, longitude)
51.5073219 -0.1276474
In [158]:
# Create a search query for venues within a xxm radius of the london centre
search_query = 'Venues'
radius = 500
limit = 100
print(search_query + ' .... OK!')
Venues .... OK!
In [159]:
def getNearbyVenues(names, latitudes, longitudes):
    radius=500
    LIMIT=100
    venues_list=[]
    for name, lat, lng in zip(names, latitudes, longitudes):
        print(name)
            
        # create the API request URL
        url = 'https://api.foursquare.com/v2/venues/explore?&client_id={}&client_secret={}&v={}&ll={},{}&radius={}&limit={}'.format(
            CLIENT_ID, 
            CLIENT_SECRET, 
            VERSION, 
            lat, 
            lng, 
            radius, 
            LIMIT)
            
        # make the GET request
        results = requests.get(url).json()["response"]['groups'][0]['items']
        
        # return only relevant information for each nearby venue
        venues_list.append([(
            name, 
            lat, 
            lng, 
            v['venue']['name'], 
            v['venue']['location']['lat'], 
            v['venue']['location']['lng'],  
            v['venue']['categories'][0]['name']) for v in results])

    nearby_venues = pd.DataFrame([item for venue_list in venues_list for item in venue_list])
    nearby_venues.columns = ['Neighborhood', 
                  'Neighborhood Latitude', 
                  'Neighborhood Longitude', 
                  'Venue', 
                  'Venue Latitude', 
                  'Venue Longitude', 
                  'Venue Category']
    
    return(nearby_venues)
In [160]:
london_venues = getNearbyVenues(names=dfldn['Borough'],
                                   latitudes=dfldn['Latitude'],
                                   longitudes=dfldn['Longitude']
                                  )
Barking and Dagenham
Barnet
Bexley
Brent
Bromley
Camden
Croydon
Ealing
Enfield
Greenwich
Hackney
Hammersmith and Fulham
Haringey
Harrow
Havering
Hillingdon
Hounslow
Islington
Kensington and Chelsea
Kingston upon Thames
Lambeth
Lewisham
Merton
Newham
Redbridge
Richmond upon Thames
Southwark
Sutton
Tower Hamlets
Waltham Forest
Wandsworth
Westminster
City of London
In [161]:
london_venues.head(5)
Out[161]:
Neighborhood Neighborhood Latitude Neighborhood Longitude Venue Venue Latitude Venue Longitude Venue Category
0 Barking and Dagenham 52 0 Central Park 52 0 Park
1 Barking and Dagenham 52 0 Crowlands Heath Golf Course 52 0 Golf Course
2 Barking and Dagenham 52 0 Robert Clack Leisure Centre 52 0 Martial Arts Dojo
3 Barking and Dagenham 52 0 Morrisons 52 0 Supermarket
4 Barking and Dagenham 52 0 Beacontree Heath Leisure Centre 52 0 Gym / Fitness Center
In [162]:
london_venues.groupby('Neighborhood').count()
Out[162]:
Neighborhood Latitude Neighborhood Longitude Venue Venue Latitude Venue Longitude Venue Category
Neighborhood
Barking and Dagenham 7 7 7 7 7 7
Barnet 4 4 4 4 4 4
Bexley 28 28 28 28 28 28
Brent 77 77 77 77 77 77
Bromley 38 38 38 38 38 38
Camden 67 67 67 67 67 67
City of London 100 100 100 100 100 100
Croydon 38 38 38 38 38 38
Ealing 73 73 73 73 73 73
Enfield 54 54 54 54 54 54
Greenwich 40 40 40 40 40 40
Hackney 56 56 56 56 56 56
Hammersmith and Fulham 82 82 82 82 82 82
Haringey 19 19 19 19 19 19
Harrow 5 5 5 5 5 5
Havering 41 41 41 41 41 41
Hillingdon 60 60 60 60 60 60
Hounslow 4 4 4 4 4 4
Islington 43 43 43 43 43 43
Kensington and Chelsea 52 52 52 52 52 52
Kingston upon Thames 100 100 100 100 100 100
Lambeth 100 100 100 100 100 100
Lewisham 31 31 31 31 31 31
Merton 21 21 21 21 21 21
Newham 13 13 13 13 13 13
Redbridge 39 39 39 39 39 39
Richmond upon Thames 51 51 51 51 51 51
Southwark 100 100 100 100 100 100
Sutton 34 34 34 34 34 34
Tower Hamlets 22 22 22 22 22 22
Waltham Forest 14 14 14 14 14 14
Wandsworth 42 42 42 42 42 42
Westminster 74 74 74 74 74 74
In [ ]:
# one hot encoding
#london_onehot = pd.get_dummies(london_venues[[' Neighborhood', 'Venue Category']], prefix="", prefix_sep="")
#london_onehot.drop(['Neighborhood'],axis=1,inplace=True) 
#london_onehot.insert(loc=0, column='Neighborhood', value=london_venues['Neighborhood'])
#london_onehot.shape
In [163]:
# one hot encoding
london_onehot = pd.get_dummies(london_venues[['Venue Category']], prefix="", prefix_sep="")
london_onehot.insert(loc=0, column='Neighborhood', value=london_venues['Neighborhood'])
london_onehot.shape
Out[163]:
(1529, 220)
In [164]:
london_grouped = london_onehot.groupby('Neighborhood').mean().reset_index()
london_grouped.head()
Out[164]:
Neighborhood African Restaurant Airport Airport Lounge Airport Service American Restaurant Antique Shop Argentinian Restaurant Art Gallery Art Museum Arts & Crafts Store Asian Restaurant Australian Restaurant BBQ Joint Bakery Bar Bed & Breakfast Beer Bar Beer Garden Beer Store Bistro Boarding House Bookstore Botanical Garden Boutique Boxing Gym Brazilian Restaurant Breakfast Spot Brewery Bubble Tea Shop Buffet Building Burger Joint Burrito Place Bus Station Bus Stop Business Service Butcher Café Cajun / Creole Restaurant Camera Store Candy Store Cantonese Restaurant Caribbean Restaurant Chaat Place Champagne Bar Chinese Restaurant Chocolate Shop Church Clothing Store Cocktail Bar Coffee Shop Concert Hall Convenience Store Cosmetics Shop Creperie Cupcake Shop Cycle Studio Dance Studio Deli / Bodega Department Store Dessert Shop Dim Sum Restaurant Diner Discount Store Donut Shop Dumpling Restaurant Eastern European Restaurant Electronics Store English Restaurant Event Space Falafel Restaurant Farmers Market Fast Food Restaurant Field Film Studio Fish & Chips Shop Fish Market Flea Market Food Court French Restaurant Fried Chicken Joint Frozen Yogurt Shop Furniture / Home Store Gaming Cafe Garden Garden Center Gas Station Gastropub German Restaurant Gift Shop Golf Course Greek Restaurant Grocery Store Gym Gym / Fitness Center Gym Pool Hardware Store Health Food Store Historic Site History Museum Hobby Shop Home Service Hookah Bar Hostel Hotel Hotel Bar Ice Cream Shop Indian Chinese Restaurant Indian Restaurant Indie Movie Theater Irish Pub Italian Restaurant Japanese Restaurant Jazz Club Jewelry Store Juice Bar Kebab Restaurant Kitchen Supply Store Korean Restaurant Latin American Restaurant Lebanese Restaurant Light Rail Station Lighting Store Liquor Store Lounge Malay Restaurant Market Martial Arts Dojo Mediterranean Restaurant Metro Station Mexican Restaurant Middle Eastern Restaurant Mobile Phone Shop Modern European Restaurant Movie Theater Multiplex Museum Music Store Music Venue New American Restaurant Nightclub Okonomiyaki Restaurant Optical Shop Organic Grocery Outdoor Event Space Outdoor Sculpture Outdoor Supply Store Outlet Mall Outlet Store Paper / Office Supplies Store Park Pedestrian Plaza Performing Arts Venue Persian Restaurant Pharmacy Pizza Place Platform Playground Plaza Polish Restaurant Pool Portuguese Restaurant Pub Public Art Rafting Ramen Restaurant Record Shop Recording Studio Rental Car Location Restaurant River Road Roof Deck Salad Place Salon / Barbershop Sandwich Place Scandinavian Restaurant Scenic Lookout Seafood Restaurant Shoe Store Shopping Mall Smoothie Shop South American Restaurant Southern / Soul Food Restaurant Souvlaki Shop Spa Spanish Restaurant Speakeasy Sporting Goods Shop Sports Bar Stadium Stationery Store Steakhouse Street Art Street Food Gathering Supermarket Sushi Restaurant Szechuan Restaurant Tapas Restaurant Tea Room Tennis Court Thai Restaurant Theater Thrift / Vintage Store Tiki Bar Toy / Game Store Train Station Turkish Restaurant Udon Restaurant Used Bookstore Vegetarian / Vegan Restaurant Video Game Store Vietnamese Restaurant Warehouse Store Wine Bar Wine Shop Winery Women's Store Yoga Studio
0 Barking and Dagenham 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 Barnet 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 Bexley 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 Brent 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 Bromley 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
In [165]:
# Rename column name 
london_grouped.rename(columns={'Neighborhood':'Borough'}, inplace=True)
london_grouped
Out[165]:
Borough African Restaurant Airport Airport Lounge Airport Service American Restaurant Antique Shop Argentinian Restaurant Art Gallery Art Museum Arts & Crafts Store Asian Restaurant Australian Restaurant BBQ Joint Bakery Bar Bed & Breakfast Beer Bar Beer Garden Beer Store Bistro Boarding House Bookstore Botanical Garden Boutique Boxing Gym Brazilian Restaurant Breakfast Spot Brewery Bubble Tea Shop Buffet Building Burger Joint Burrito Place Bus Station Bus Stop Business Service Butcher Café Cajun / Creole Restaurant Camera Store Candy Store Cantonese Restaurant Caribbean Restaurant Chaat Place Champagne Bar Chinese Restaurant Chocolate Shop Church Clothing Store Cocktail Bar Coffee Shop Concert Hall Convenience Store Cosmetics Shop Creperie Cupcake Shop Cycle Studio Dance Studio Deli / Bodega Department Store Dessert Shop Dim Sum Restaurant Diner Discount Store Donut Shop Dumpling Restaurant Eastern European Restaurant Electronics Store English Restaurant Event Space Falafel Restaurant Farmers Market Fast Food Restaurant Field Film Studio Fish & Chips Shop Fish Market Flea Market Food Court French Restaurant Fried Chicken Joint Frozen Yogurt Shop Furniture / Home Store Gaming Cafe Garden Garden Center Gas Station Gastropub German Restaurant Gift Shop Golf Course Greek Restaurant Grocery Store Gym Gym / Fitness Center Gym Pool Hardware Store Health Food Store Historic Site History Museum Hobby Shop Home Service Hookah Bar Hostel Hotel Hotel Bar Ice Cream Shop Indian Chinese Restaurant Indian Restaurant Indie Movie Theater Irish Pub Italian Restaurant Japanese Restaurant Jazz Club Jewelry Store Juice Bar Kebab Restaurant Kitchen Supply Store Korean Restaurant Latin American Restaurant Lebanese Restaurant Light Rail Station Lighting Store Liquor Store Lounge Malay Restaurant Market Martial Arts Dojo Mediterranean Restaurant Metro Station Mexican Restaurant Middle Eastern Restaurant Mobile Phone Shop Modern European Restaurant Movie Theater Multiplex Museum Music Store Music Venue New American Restaurant Nightclub Okonomiyaki Restaurant Optical Shop Organic Grocery Outdoor Event Space Outdoor Sculpture Outdoor Supply Store Outlet Mall Outlet Store Paper / Office Supplies Store Park Pedestrian Plaza Performing Arts Venue Persian Restaurant Pharmacy Pizza Place Platform Playground Plaza Polish Restaurant Pool Portuguese Restaurant Pub Public Art Rafting Ramen Restaurant Record Shop Recording Studio Rental Car Location Restaurant River Road Roof Deck Salad Place Salon / Barbershop Sandwich Place Scandinavian Restaurant Scenic Lookout Seafood Restaurant Shoe Store Shopping Mall Smoothie Shop South American Restaurant Southern / Soul Food Restaurant Souvlaki Shop Spa Spanish Restaurant Speakeasy Sporting Goods Shop Sports Bar Stadium Stationery Store Steakhouse Street Art Street Food Gathering Supermarket Sushi Restaurant Szechuan Restaurant Tapas Restaurant Tea Room Tennis Court Thai Restaurant Theater Thrift / Vintage Store Tiki Bar Toy / Game Store Train Station Turkish Restaurant Udon Restaurant Used Bookstore Vegetarian / Vegan Restaurant Video Game Store Vietnamese Restaurant Warehouse Store Wine Bar Wine Shop Winery Women's Store Yoga Studio
0 Barking and Dagenham 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 Barnet 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 Bexley 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 Brent 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 Bromley 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 Camden 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 City of London 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 Croydon 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 Ealing 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 Enfield 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
10 Greenwich 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
11 Hackney 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12 Hammersmith and Fulham 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
13 Haringey 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
14 Harrow 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15 Havering 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
16 Hillingdon 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
17 Hounslow 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
18 Islington 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
19 Kensington and Chelsea 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
20 Kingston upon Thames 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
21 Lambeth 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
22 Lewisham 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
23 Merton 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
24 Newham 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
25 Redbridge 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
26 Richmond upon Thames 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
27 Southwark 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
28 Sutton 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
29 Tower Hamlets 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
30 Waltham Forest 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
31 Wandsworth 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
32 Westminster 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
In [167]:
# Let's confirm the new size
london_grouped.shape
Out[167]:
(33, 220)
In [168]:
# Let's print each neighborhood along with the top 5 most common venues
num_top_venues = 5

for hood in london_grouped['Borough']:
    print("----"+hood+"----")
    temp = london_grouped[london_grouped['Borough'] == hood].T.reset_index()
    temp.columns = ['venue','freq']
    temp = temp.iloc[1:]
    temp['freq'] = temp['freq'].astype(float)
    temp = temp.round({'freq': 2})
    print(temp.sort_values('freq', ascending=False).reset_index(drop=True).head(num_top_venues))
    print('\n')
----Barking and Dagenham----
               venue  freq
0  Martial Arts Dojo     0
1               Pool     0
2        Bus Station     0
3        Supermarket     0
4        Golf Course     0


----Barnet----
                venue  freq
0                Café     0
1            Bus Stop     0
2        Home Service     0
3  African Restaurant     0
4                Park     0


----Bexley----
                venue  freq
0      Clothing Store     0
1         Coffee Shop     0
2                 Pub     0
3         Supermarket     0
4  Italian Restaurant     0


----Brent----
                 venue  freq
0       Clothing Store     0
1          Coffee Shop     0
2                Hotel     0
3                  Bar     0
4  Sporting Goods Shop     0


----Bromley----
            venue  freq
0  Clothing Store     0
1     Coffee Shop     0
2    Burger Joint     0
3             Bar     0
4     Pizza Place     0


----Camden----
          venue  freq
0   Coffee Shop     0
1          Café     0
2           Pub     0
3         Hotel     0
4  Burger Joint     0


----City of London----
               venue  freq
0        Coffee Shop     0
1           Wine Bar     0
2  French Restaurant     0
3     Clothing Store     0
4         Restaurant     0


----Croydon----
                   venue  freq
0                    Pub     0
1            Coffee Shop     0
2  Portuguese Restaurant     0
3                   Café     0
4                Brewery     0


----Ealing----
            venue  freq
0     Coffee Shop     0
1             Pub     0
2  Clothing Store     0
3          Bakery     0
4           Hotel     0


----Enfield----
            venue  freq
0  Clothing Store     0
1     Coffee Shop     0
2    Optical Shop     0
3             Pub     0
4            Café     0


----Greenwich----
            venue  freq
0             Pub     0
1     Coffee Shop     0
2     Supermarket     0
3  Clothing Store     0
4           Plaza     0


----Hackney----
          venue  freq
0           Pub     0
1   Coffee Shop     0
2          Café     0
3  Cocktail Bar     0
4        Bakery     0


----Hammersmith and Fulham----
               venue  freq
0                Pub     0
1               Café     0
2              Hotel     0
3  Indian Restaurant     0
4        Coffee Shop     0


----Haringey----
                  venue  freq
0  Fast Food Restaurant     0
1    Turkish Restaurant     0
2                   Pub     0
3         Movie Theater     0
4         Grocery Store     0


----Harrow----
                 venue  freq
0  Indie Movie Theater     0
1    Indian Restaurant     0
2          Supermarket     0
3          Coffee Shop     0
4        Grocery Store     0


----Havering----
                  venue  freq
0           Coffee Shop     0
1        Clothing Store     0
2         Shopping Mall     0
3  Fast Food Restaurant     0
4                   Pub     0


----Hillingdon----
                venue  freq
0         Coffee Shop     0
1      Clothing Store     0
2  Italian Restaurant     0
3            Pharmacy     0
4         Pizza Place     0


----Hounslow----
                venue  freq
0     Bed & Breakfast     0
1                Café     0
2       Metro Station     0
3                Park     0
4  African Restaurant     0


----Islington----
            venue  freq
0             Pub     0
1         Theater     0
2  Ice Cream Shop     0
3        Boutique     0
4    Burger Joint     0


----Kensington and Chelsea----
            venue  freq
0  Clothing Store     0
1       Juice Bar     0
2          Bakery     0
3            Café     0
4             Pub     0


----Kingston upon Thames----
                venue  freq
0         Coffee Shop     0
1                Café     0
2      Clothing Store     0
3                 Pub     0
4  Italian Restaurant     0


----Lambeth----
                  venue  freq
0  Caribbean Restaurant     0
1           Coffee Shop     0
2                Market     0
3                   Pub     0
4           Pizza Place     0


----Lewisham----
                venue  freq
0         Supermarket     0
1       Grocery Store     0
2       Train Station     0
3  Italian Restaurant     0
4            Platform     0


----Merton----
                  venue  freq
0  Fast Food Restaurant     0
1    Italian Restaurant     0
2                  Café     0
3           Supermarket     0
4                  Park     0


----Newham----
             venue  freq
0            Hotel     0
1  Airport Service     0
2   Sandwich Place     0
3          Airport     0
4         Pharmacy     0


----Redbridge----
                  venue  freq
0        Clothing Store     0
1           Supermarket     0
2  Fast Food Restaurant     0
3                Bakery     0
4      Department Store     0


----Richmond upon Thames----
                venue  freq
0                 Pub     0
1         Coffee Shop     0
2  Italian Restaurant     0
3            Pharmacy     0
4       Grocery Store     0


----Southwark----
               venue  freq
0        Coffee Shop     0
1                Pub     0
2       Cocktail Bar     0
3                Bar     0
4  French Restaurant     0


----Sutton----
              venue  freq
0               Pub     0
1    Clothing Store     0
2       Coffee Shop     0
3              Café     0
4  Department Store     0


----Tower Hamlets----
                  venue  freq
0    Italian Restaurant     0
1  Gym / Fitness Center     0
2                  Café     0
3           Pizza Place     0
4           Coffee Shop     0


----Waltham Forest----
          venue  freq
0           Pub     0
1   Coffee Shop     0
2  Concert Hall     0
3    Beer Store     0
4         Field     0


----Wandsworth----
            venue  freq
0             Pub     0
1     Coffee Shop     0
2  Clothing Store     0
3  Sandwich Place     0
4     Supermarket     0


----Westminster----
            venue  freq
0           Hotel     0
1     Coffee Shop     0
2  Sandwich Place     0
3         Theater     0
4             Pub     0


In [169]:
# Let's put that into a pandas dataframe

# First, let's write a function to sort the venues in descending order.

def return_most_common_venues(row, num_top_venues):
    row_categories = row.iloc[1:]
    row_categories_sorted = row_categories.sort_values(ascending=False)
    
    return row_categories_sorted.index.values[0:num_top_venues]

london_grouped.head(5)
Out[169]:
Borough African Restaurant Airport Airport Lounge Airport Service American Restaurant Antique Shop Argentinian Restaurant Art Gallery Art Museum Arts & Crafts Store Asian Restaurant Australian Restaurant BBQ Joint Bakery Bar Bed & Breakfast Beer Bar Beer Garden Beer Store Bistro Boarding House Bookstore Botanical Garden Boutique Boxing Gym Brazilian Restaurant Breakfast Spot Brewery Bubble Tea Shop Buffet Building Burger Joint Burrito Place Bus Station Bus Stop Business Service Butcher Café Cajun / Creole Restaurant Camera Store Candy Store Cantonese Restaurant Caribbean Restaurant Chaat Place Champagne Bar Chinese Restaurant Chocolate Shop Church Clothing Store Cocktail Bar Coffee Shop Concert Hall Convenience Store Cosmetics Shop Creperie Cupcake Shop Cycle Studio Dance Studio Deli / Bodega Department Store Dessert Shop Dim Sum Restaurant Diner Discount Store Donut Shop Dumpling Restaurant Eastern European Restaurant Electronics Store English Restaurant Event Space Falafel Restaurant Farmers Market Fast Food Restaurant Field Film Studio Fish & Chips Shop Fish Market Flea Market Food Court French Restaurant Fried Chicken Joint Frozen Yogurt Shop Furniture / Home Store Gaming Cafe Garden Garden Center Gas Station Gastropub German Restaurant Gift Shop Golf Course Greek Restaurant Grocery Store Gym Gym / Fitness Center Gym Pool Hardware Store Health Food Store Historic Site History Museum Hobby Shop Home Service Hookah Bar Hostel Hotel Hotel Bar Ice Cream Shop Indian Chinese Restaurant Indian Restaurant Indie Movie Theater Irish Pub Italian Restaurant Japanese Restaurant Jazz Club Jewelry Store Juice Bar Kebab Restaurant Kitchen Supply Store Korean Restaurant Latin American Restaurant Lebanese Restaurant Light Rail Station Lighting Store Liquor Store Lounge Malay Restaurant Market Martial Arts Dojo Mediterranean Restaurant Metro Station Mexican Restaurant Middle Eastern Restaurant Mobile Phone Shop Modern European Restaurant Movie Theater Multiplex Museum Music Store Music Venue New American Restaurant Nightclub Okonomiyaki Restaurant Optical Shop Organic Grocery Outdoor Event Space Outdoor Sculpture Outdoor Supply Store Outlet Mall Outlet Store Paper / Office Supplies Store Park Pedestrian Plaza Performing Arts Venue Persian Restaurant Pharmacy Pizza Place Platform Playground Plaza Polish Restaurant Pool Portuguese Restaurant Pub Public Art Rafting Ramen Restaurant Record Shop Recording Studio Rental Car Location Restaurant River Road Roof Deck Salad Place Salon / Barbershop Sandwich Place Scandinavian Restaurant Scenic Lookout Seafood Restaurant Shoe Store Shopping Mall Smoothie Shop South American Restaurant Southern / Soul Food Restaurant Souvlaki Shop Spa Spanish Restaurant Speakeasy Sporting Goods Shop Sports Bar Stadium Stationery Store Steakhouse Street Art Street Food Gathering Supermarket Sushi Restaurant Szechuan Restaurant Tapas Restaurant Tea Room Tennis Court Thai Restaurant Theater Thrift / Vintage Store Tiki Bar Toy / Game Store Train Station Turkish Restaurant Udon Restaurant Used Bookstore Vegetarian / Vegan Restaurant Video Game Store Vietnamese Restaurant Warehouse Store Wine Bar Wine Shop Winery Women's Store Yoga Studio
0 Barking and Dagenham 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 Barnet 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 Bexley 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
3 Brent 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4 Bromley 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
In [170]:
# Now let's create the new dataframe and display the top 10 venues for each neighborhood
num_top_venues = 10

indicators = ['st', 'nd', 'rd']

# create columns according to number of top venues
columns = ['Borough']
for ind in np.arange(num_top_venues):
    try:
        columns.append('{}{} Most Common Venue'.format(ind+1, indicators[ind]))
    except:
        columns.append('{}th Most Common Venue'.format(ind+1))

# create a new dataframe
neighborhoods_venues_sorted = pd.DataFrame(columns=columns)
neighborhoods_venues_sorted['Borough'] = london_grouped['Borough']

for ind in np.arange(london_grouped.shape[0]):
    neighborhoods_venues_sorted.iloc[ind, 1:] = return_most_common_venues(london_grouped.iloc[ind, :], num_top_venues)

neighborhoods_venues_sorted.head()
Out[170]:
Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue
0 Barking and Dagenham Pool Golf Course Bus Station Supermarket Martial Arts Dojo Park Gym / Fitness Center Fish Market Fish & Chips Shop Film Studio
1 Barnet Café Home Service Bus Stop Yoga Studio Event Space Food Court Flea Market Fish Market Fish & Chips Shop Film Studio
2 Bexley Coffee Shop Pub Clothing Store Italian Restaurant Pharmacy Supermarket Portuguese Restaurant Bakery Furniture / Home Store Fast Food Restaurant
3 Brent Clothing Store Coffee Shop Hotel Bar Sporting Goods Shop Grocery Store Sandwich Place American Restaurant Food Court Burger Joint
4 Bromley Clothing Store Coffee Shop Pizza Place Burger Joint Bar Portuguese Restaurant Stationery Store English Restaurant Electronics Store Bookstore
In [171]:
neighborhoods_venues_sorted.dtypes
Out[171]:
Borough                   object
1st Most Common Venue     object
2nd Most Common Venue     object
3rd Most Common Venue     object
4th Most Common Venue     object
5th Most Common Venue     object
6th Most Common Venue     object
7th Most Common Venue     object
8th Most Common Venue     object
9th Most Common Venue     object
10th Most Common Venue    object
dtype: object
Clustering the London boroughs
In [172]:
# Run k-means to cluster the boroughs into 10 clusters

# set number of clusters
kclusters = 10

london_grouped_clustering = london_grouped.drop('Borough', 1) # dropping the string column

# run k-means clustering
kmeans = KMeans(n_clusters=kclusters, random_state=0).fit(london_grouped_clustering)

# check cluster labels generated for each row in the dataframe
kmeans.labels_[0:10]
Out[172]:
array([7, 2, 8, 1, 8, 1, 1, 5, 1, 8], dtype=int32)
In [178]:
# Let's create a new dataframe that includes the cluster as well as the top 10 venues for each neighborhood

# add clustering labels
neighborhoods_venues_sorted.insert(0, 'Cluster Labels', kmeans.labels_)
# neighborhoods_venues_sorted # print file to check

# merge neighborhoods_venues_sorted with toronto_data to add latitude/longitude for each neighborhood
london_merged = neighborhoods_venues_sorted.join(dfldn.set_index('Borough'), on='Borough')

london_merged.head() # check the last columns!
Out[178]:
Cluster Labels Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
0 7 Barking and Dagenham Pool Golf Course Bus Station Supermarket Martial Arts Dojo Park Gym / Fitness Center Fish Market Fish & Chips Shop Film Studio 52 0
1 2 Barnet Café Home Service Bus Stop Yoga Studio Event Space Food Court Flea Market Fish Market Fish & Chips Shop Film Studio 52 -0
2 8 Bexley Coffee Shop Pub Clothing Store Italian Restaurant Pharmacy Supermarket Portuguese Restaurant Bakery Furniture / Home Store Fast Food Restaurant 51 0
3 1 Brent Clothing Store Coffee Shop Hotel Bar Sporting Goods Shop Grocery Store Sandwich Place American Restaurant Food Court Burger Joint 52 -0
4 8 Bromley Clothing Store Coffee Shop Pizza Place Burger Joint Bar Portuguese Restaurant Stationery Store English Restaurant Electronics Store Bookstore 51 0
In [179]:
london_merged.dtypes
Out[179]:
Cluster Labels              int32
Borough                    object
1st Most Common Venue      object
2nd Most Common Venue      object
3rd Most Common Venue      object
4th Most Common Venue      object
5th Most Common Venue      object
6th Most Common Venue      object
7th Most Common Venue      object
8th Most Common Venue      object
9th Most Common Venue      object
10th Most Common Venue     object
Latitude                  float64
Longitude                 float64
dtype: object
In [180]:
address = 'London, UK'

geolocator = Nominatim(user_agent="ldn_explorer")
location = geolocator.geocode(address)
latitude = location.latitude
longitude = location.longitude
print('The geograpical coordinates of London are {}, {}.'.format(latitude, longitude))
The geograpical coordinates of London are 51.5073219, -0.1276474.
In [181]:
map_clusters = folium.Map(location=[latitude, longitude], zoom_start=11)

# set color scheme for the clusters
x = np.arange(kclusters)
ys = [i + x + (i*x)**2 for i in range(kclusters)]
colors_array = cm.rainbow(np.linspace(0, 1, len(ys)))
rainbow = [colors.rgb2hex(i) for i in colors_array]

# add markers to the map
markers_colors = []
for lat, lon, poi, cluster in zip(london_merged['Latitude'], london_merged['Longitude'], london_merged['Borough'], london_merged['Cluster Labels']):
    label = folium.Popup(str(poi) + ' Cluster ' + str(cluster), parse_html=True)
    folium.CircleMarker(
        [lat, lon],
        radius=5,
        popup=label,
        color=rainbow[cluster-1],
        fill=True,
        fill_color=rainbow[cluster-1],
        fill_opacity=0.7).add_to(map_clusters)
       
map_clusters
Out[181]:

Examining the clusters

In [182]:
# Cluster 0 (Red) - Indian lifestyle cluster
london_merged.loc[london_merged['Cluster Labels'] == 0, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[182]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
17 Hounslow Hounslow Metro Station Café Park Bed & Breakfast Yoga Studio Event Space Food Court Flea Market Fish Market Fish & Chips Shop 51 -0
In [183]:
# Cluster 1 (Purple) - retail and social cluster
london_merged.loc[london_merged['Cluster Labels'] == 1, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[183]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
3 Brent Brent Clothing Store Coffee Shop Hotel Bar Sporting Goods Shop Grocery Store Sandwich Place American Restaurant Food Court Burger Joint 52 -0
5 Camden Camden Coffee Shop Café Hotel Pub Burger Joint Train Station Garden Breakfast Spot Pizza Place Hotel Bar 52 -0
6 City of London City of London Coffee Shop Clothing Store Scenic Lookout Hotel Steakhouse French Restaurant Restaurant Italian Restaurant Gym / Fitness Center Wine Bar 52 -0
8 Ealing Ealing Coffee Shop Clothing Store Pub Bakery Hotel Park Vietnamese Restaurant Café Pizza Place Italian Restaurant 52 -0
11 Hackney Hackney Pub Coffee Shop Café Cocktail Bar Bakery Grocery Store Modern European Restaurant Brewery Bar Clothing Store 52 -0
12 Hammersmith and Fulham Hammersmith and Fulham Pub Café Hotel Indian Restaurant Coffee Shop Italian Restaurant Gastropub Clothing Store Thai Restaurant Japanese Restaurant 51 -0
19 Kensington and Chelsea Kensington and Chelsea Clothing Store Café Juice Bar Bakery Gym / Fitness Center Restaurant Hotel Art Gallery Pub Breakfast Spot 52 -0
20 Kingston upon Thames Kingston upon Thames Coffee Shop Café Clothing Store Pub Bakery Italian Restaurant Department Store Burger Joint Bookstore Ice Cream Shop 51 -0
21 Lambeth Lambeth Caribbean Restaurant Pub Market Coffee Shop Pizza Place Mexican Restaurant Gym / Fitness Center Beer Bar Cocktail Bar Grocery Store 51 -0
27 Southwark Southwark Coffee Shop Pub Cocktail Bar Bar Scenic Lookout French Restaurant Restaurant Café Hotel Italian Restaurant 52 -0
29 Tower Hamlets Tower Hamlets Italian Restaurant Hotel Café Gym / Fitness Center Pizza Place Coffee Shop Indian Restaurant Gym Pool Grocery Store Light Rail Station 52 -0
32 Westminster Westminster Hotel Coffee Shop Sandwich Place Pub Theater Italian Restaurant Gym / Fitness Center Sushi Restaurant Indian Restaurant Sporting Goods Shop 51 -0
In [184]:
# Cluster 2 (blue) - mixed use borough
london_merged.loc[london_merged['Cluster Labels'] == 2, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[184]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
1 Barnet Barnet Café Home Service Bus Stop Yoga Studio Event Space Food Court Flea Market Fish Market Fish & Chips Shop Film Studio 52 -0
In [185]:
# Cluster 3 (blue-turques) - fitness cluster
london_merged.loc[london_merged['Cluster Labels'] == 3, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[185]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
24 Newham Newham Hotel Airport Service Chinese Restaurant Airport Airport Lounge Rafting Sandwich Place Pharmacy Fast Food Restaurant Event Space 52 0
In [186]:
# Cluster 4 (turkques) - markets cluster
london_merged.loc[london_merged['Cluster Labels'] == 4, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[186]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
14 Harrow Harrow Indie Movie Theater Grocery Store Coffee Shop Supermarket Indian Restaurant Hostel Eastern European Restaurant Fish Market Fish & Chips Shop Film Studio 52 -0
In [187]:
# Cluster 5 (green) - social cluster
london_merged.loc[london_merged['Cluster Labels'] == 5, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[187]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
7 Croydon Croydon Pub Coffee Shop Portuguese Restaurant Burrito Place Supermarket Bookstore Gaming Cafe Breakfast Spot Brewery Spanish Restaurant 51 -0
26 Richmond upon Thames Richmond upon Thames Pub Coffee Shop Italian Restaurant Pharmacy Grocery Store Indian Restaurant Garden Bookstore Discount Store Steakhouse 51 -0
30 Waltham Forest Waltham Forest Pub Coffee Shop Gym / Fitness Center Pizza Place Concert Hall Field Beer Store Tea Room Grocery Store Pool 52 -0
31 Wandsworth Wandsworth Pub Coffee Shop Clothing Store Pizza Place Breakfast Spot Supermarket Asian Restaurant Sandwich Place Indian Restaurant Restaurant 51 -0
In [188]:
# Cluster 6 (green - yellow) - hotel cluster
london_merged.loc[london_merged['Cluster Labels'] == 6, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[188]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
18 Islington Islington Pub Park Theater Burger Joint Ice Cream Shop Boutique Cocktail Bar Coffee Shop Clothing Store Organic Grocery 52 -0
In [189]:
# Cluster 7 (mustard) - travellers cluster
london_merged.loc[london_merged['Cluster Labels'] == 7, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[189]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
0 Barking and Dagenham Barking and Dagenham Pool Golf Course Bus Station Supermarket Martial Arts Dojo Park Gym / Fitness Center Fish Market Fish & Chips Shop Film Studio 52 0
In [190]:
# Cluster 8 (yellow) - meal cluster
london_merged.loc[london_merged['Cluster Labels'] == 8, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[190]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
2 Bexley Bexley Coffee Shop Pub Clothing Store Italian Restaurant Pharmacy Supermarket Portuguese Restaurant Bakery Furniture / Home Store Fast Food Restaurant 51 0
4 Bromley Bromley Clothing Store Coffee Shop Pizza Place Burger Joint Bar Portuguese Restaurant Stationery Store English Restaurant Electronics Store Bookstore 51 0
9 Enfield Enfield Clothing Store Coffee Shop Optical Shop Pub Café Bookstore Restaurant Turkish Restaurant Supermarket Gift Shop 52 -0
10 Greenwich Greenwich Pub Supermarket Coffee Shop Clothing Store Hotel Pharmacy Plaza Fast Food Restaurant Grocery Store African Restaurant 51 0
15 Havering Havering Coffee Shop Clothing Store Fast Food Restaurant Shopping Mall Bakery Department Store Pub Café Bookstore Hotel 52 0
16 Hillingdon Hillingdon Coffee Shop Italian Restaurant Clothing Store Pharmacy Burger Joint Pizza Place Pub Fast Food Restaurant Sandwich Place Shopping Mall 52 -0
22 Lewisham Lewisham Supermarket Grocery Store Platform Coffee Shop Italian Restaurant Train Station Cocktail Bar Bakery Pizza Place Portuguese Restaurant 51 -0
25 Redbridge Redbridge Clothing Store Fast Food Restaurant Supermarket Coffee Shop Bakery Grocery Store Sandwich Place Department Store Pub Optical Shop 52 0
28 Sutton Sutton Pub Clothing Store Coffee Shop Pizza Place Department Store Italian Restaurant Sandwich Place Café Bar Bakery 51 -0
In [191]:
# Cluster 9 (orange) - lifestyle cluster
london_merged.loc[london_merged['Cluster Labels'] == 9, london_merged.columns[[1] + list(range(1, london_merged.shape[1]))]]
Out[191]:
Borough Borough 1st Most Common Venue 2nd Most Common Venue 3rd Most Common Venue 4th Most Common Venue 5th Most Common Venue 6th Most Common Venue 7th Most Common Venue 8th Most Common Venue 9th Most Common Venue 10th Most Common Venue Latitude Longitude
13 Haringey Haringey Fast Food Restaurant Portuguese Restaurant Bar Indian Restaurant Italian Restaurant Gym / Fitness Center Grocery Store Mediterranean Restaurant Movie Theater Discount Store 52 -0
23 Merton Merton Café Pizza Place Fast Food Restaurant Italian Restaurant Supermarket Park Grocery Store Bakery Metro Station Garden Center 51 -0

Thank you